aconite Posted March 21, 2007 Share Posted March 21, 2007 im trying to run a query in php and then access the row of the result set. the code im using is for($j=1;$j<$i;$j++) {echo $seat_nos[$j]; $ss=$seat_nos[$j] ; $q0="SELECT status FROM seats WHERE seat='$ss' and id='$bus'"; $chck=mysql_query($q0); $cc=mysql_fetch_row($chck); echo $cc['status']; if($cc[0]=='booked') {echo "FOLLOWING SEAT ALREADY BOOKED : "; echo $ss; exit(); } if($cc[0]==NULL) {echo "NULL : "; exit(); } } this code always gives $cc[0]==NULL as true...whereas in the database the possible values for status are 'booked' or empty. (i have checked this query in MYSql command prompt.it returns either 'empty' or 'booked'). variable bus and ss both have valid values i checked by displayin them. i really dont get what the problem is ??? Link to comment https://forums.phpfreaks.com/topic/43680-problem-using-mysql_fetch_row/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.