如何订购mySql查询,其间有Get方法?

时间:2021-09-01 11:23:48

I am trying to order my results of the following Query

我试图订购以下查询的结果

$q_getPROVINCE = "select * from PROVINCES  WHERE CID =".$_GET['id'];
$r_getPROVINCE = mysql_query($q_getPROVINCE, $connection);
$n_getPROVINCE = mysql_num_rows($r_getPROVINCE);

it works perfectly but MY problem is that whenever I try to order it Im not sure how to write it, having the GET_ method in between.

它工作得很完美,但我的问题是,每当我尝试订购它时,我不确定如何编写它,在它们之间使用GET_方法。

$q_getPROVINCE = "select * from PROVINCES  WHERE CID =".$_GET['id']."ORDER BY CITY_EN ASC";
$r_getPROVINCE = mysql_query($q_getPROVINCE, $connection);
$n_getPROVINCE = mysql_num_rows($r_getPROVINCE);

I would appreciate your help...

我很感激你的帮助......

2 个解决方案

#1


0  

Your code looks fine may be you have give space between ORDER BY before " symbol. Try this

您的代码看起来很好可能是您在“符号”之前在ORDER BY之间留出空格。试试这个

#2


0  

Did you try to put a space before ORDER ? Like this :

你试过在ORDER之前放一个空格吗?像这样 :

$q_getPROVINCE = "select * from PROVINCES  WHERE CID =".$_GET['id']." ORDER BY CITY_EN ASC";

#1


0  

Your code looks fine may be you have give space between ORDER BY before " symbol. Try this

您的代码看起来很好可能是您在“符号”之前在ORDER BY之间留出空格。试试这个

#2


0  

Did you try to put a space before ORDER ? Like this :

你试过在ORDER之前放一个空格吗?像这样 :

$q_getPROVINCE = "select * from PROVINCES  WHERE CID =".$_GET['id']." ORDER BY CITY_EN ASC";