简单的CMS mySQL / PHP [英] Simple CMS mySQL / PHP

查看:143
本文介绍了简单的CMS mySQL / PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我有这个小项目,我一直在工作。我有一个看起来像这样的mySQL表。

Okay, so I have this small project I have been working on. I have a mySQL table that looks kind of like this

+---------+-------------+------+
| Content | Date Posted | Name |
+---------+-------------+------+
| Content | Date Posted | Name |
+---------+-------------+------+

我需要一个PHP脚本从数据库中读取前10行,基于日期。

And I need a PHP script to read the top 10 rows from the database, based on date posted.

推荐答案

您可以使用PHPMyAdmin创建表或运行如下脚本:

You can use PHPMyAdmin to create tables, or run a script like this:

CREATE TABLE Contents (
  Content MEMO NOT NULL,
  DatePosted DATE NOT NULL,
  Name VARCHAR2(200) NOT NULL);

并选择最新的10如下:

and select the newest 10 like this:

SELECT
  t.Content,
  t.DatePosted,
  t.Name
FROM
  Contents t
ORDER BY
  DatePosted DESC
LIMIT 10

但是尽管答案似乎很小,它实际上是一个大问题。你不知道什么吗?也许你应该开始阅读一些教程,如果你不想陷入每次你需要一些东西从你的数据库。

But while the answer seems small, it is actually a big question. Do you have no idea whatsoever? Maybe you should start by reading some tutorials if you don't want to get stuck every time you need a little something from your database.

这篇关于简单的CMS mySQL / PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆