Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中获取升序数据?_Php_Mysql_Syntax Error - Fatal编程技术网

如何在php中获取升序数据?

如何在php中获取升序数据?,php,mysql,syntax-error,Php,Mysql,Syntax Error,阿斯兰 我希望你一切都好。。 我的问题是当我写 $query = "select * from posts order by DESC LIMIT 0,1200";<br/> $run = mysql_query($query);<br/> while($row=mysql_fetch_array($run)){<br/> $post_id = $row['un_id'];<br/> $title = $row['post_title'];&

阿斯兰
我希望你一切都好。。
我的问题是当我写

$query = "select * from posts order by DESC LIMIT 0,1200";<br/>

$run = mysql_query($query);<br/>

while($row=mysql_fetch_array($run)){<br/>
$post_id = $row['un_id'];<br/>
$title = $row['post_title'];<br/>
$image = $row['post_image'];<br/>
$query=“按DESC LIMIT 01200从邮政订单中选择*”
$run=mysql\u query($query)
而($row=mysql\u fetch\u array($run)){
$post_id=$row['un_id'];
$title=$row['post_title'];
$image=$row['post_image'];
一切正常,但当我将DSEC更改为ASE时,php显示错误。

警告:mysql\u fetch\u array()希望参数1是资源,布尔值在第63行的E:\Xampp\htdocs\lask\m\new\u post.php中给出

链接编号63是

while($row=mysql_fetch_array($run)){<br/>
while($row=mysql\u fetch\u array($run)){

ASE
不存在,它是
ASC
DESC

请尝试此请求:

$query = "select * from posts order by un_id ASC LIMIT 0,1200";

关键字是
ASC

ASE
不作为关键字存在


试试这个:
$query=“select*from posts order by ASC LIMIT 01200”

因为,
ASE
不是MySQL关键字

请尝试ASC:

$query = "select * from posts order by ASC LIMIT 0,1200";

您需要将其
DESC
更改为
ASC
。可能存在重复