<?php $ssresult = mysql_query("SELECT * FROM gm_special order by w_date desc"); while($result_row= mysql_fetch_array($ssresult)){ $date=$result_row['w_number']; $ss1= mysql_query("SELECT * FROM tablename WHERE cat='category_1' AND w_number = '$date' "); $ss_1=mysql_fetch_array($ss1); $ss2= mysql_query("SELECT * FROM tablename WHERE cat='category_2' and w_number = '$date' "); $ss2_1=mysql_fetch_array($ss2); } ?> why showing error ?? can i use mysql_fetch_array under another mysql_fetch_array???
$ss1 or $ss2 might be empty and therefore mysql_fetch_array returns an error. Try checking the variable before running through mysql_fetch_array. Just a suggestion.
First of all check the value of the $date do you receive this value proper or not. If yes then have practice to make your query like below: $ss1= mysql_query("SELECT * FROM tablename WHERE cat='".category_1."' AND w_number = '".$date."'"); I think you might try this and let me know. Hope this helps Avi
of course be sure that the table "tablename" is there in db, and there's a "category_1" field syntax should be like this: $ss1= mysql_query("SELECT * FROM `tablename` WHERE `cat`='category_1' AND `w_number`='".$date."';"); also, are you sure that you are fetching the right field: $date=$result_row['w_number']; ??? or maybe: $date=$result_row['w_date']; ?