Reputation: 31
I need a help to solution that: I need to do a table with a value of 4 different my sql arrays, like:
$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");
And I make four arrays with each one:
$find1 = mysql_fetch_array($sql);
$find2 = mysql_fetch_array($sql2);
$find3 = mysql_fetch_array($sql3);
$find4 = mysql_fetch_array($sql4);
Now, I need to do 10 times, a table with value of all of that arrays, but need to be order, without repeat and side by side, split in category.
Like 4 columns, each have order and different value of work_category
.
Thank you!
Upvotes: 3
Views: 45
Reputation: 9442
Why not change the query to get all results at once:
SELECT * FROM tbl_work WHERE work_category IN (1,2,3,4) ORDER BY note DESC
P.S: Use PDO
, mysql_*
are deprecated.
Upvotes: 6