我需要一个解决方案的帮助:我需要做一个值为4个不同的我的sql数组的表,如:
$sql = MysqL_query("select * from tbl_work where work_category = 1
ORDER BY note DESC");
$sql2 = MysqL_query("select * from tbl_work where work_category = 2
ORDER BY note DESC");
$sql3 = MysqL_query("select * from tbl_work where work_category = 3
ORDER BY note DESC");
$sql4 = MysqL_query("select * from tbl_work where work_category = 4
ORDER BY note DESC");
我每个都制作了四个数组:
$find1 = MysqL_fetch_array($sql);
$find2 = MysqL_fetch_array($sql2);
$find3 = MysqL_fetch_array($sql3);
$find4 = MysqL_fetch_array($sql4);
现在,我需要做10次,一个具有所有数组值的表,但需要按顺序排列,不重复,并排分类.
像4列一样,每个列都有work_category的顺序和不同的值.
谢谢!
解决方法:
SELECT * FROM tbl_work WHERE work_category IN (1,2,3,4) ORDER BY note DESC
P.S:使用PDO,不推荐使用MysqL_ *.