rabesh Posted June 1, 2011 Share Posted June 1, 2011 <?php $limit=12; if(isset( $_GET['page'])) $page=$_GET['page']; if($page<=0) $page = 1; else {$start=0;} $sql=mysql_query('select * from tbl_gallery where status=1 AND category_name="0"'); $count=mysql_num_rows($sql); $totalcount=ceil($count/$limit); $start=($page-1)*$limit; $s=mysql_query('select * from tbl_gallery where status=1 AND category_name="0" limit $start, $limit'); while($result=mysql_fetch_array($s)){ $start++; ?> MOD EDIT: code tags added. Quote Link to comment https://forums.phpfreaks.com/topic/238059-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/ Share on other sites More sharing options...
Pikachu2000 Posted June 1, 2011 Share Posted June 1, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/238059-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1223337 Share on other sites More sharing options...
rabesh Posted June 1, 2011 Author Share Posted June 1, 2011 I am new user of this forum so i dont know...please solve my problem...... Error in $s=mysql_query('select * from tbl_gallery where status=1 AND category_name="0" limit $start, $limit'); above line Quote Link to comment https://forums.phpfreaks.com/topic/238059-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1223338 Share on other sites More sharing options...
Pikachu2000 Posted June 1, 2011 Share Posted June 1, 2011 That error indicates that a query failed. I don't see anywhere in that code where you make a connection to the database. Is that done somewhere else in the script? One problem you have is that variables are not interpolated in single quoted strings, so the query should be rewritten using double quotes to enclose it. $query = "select * from tbl_gallery where status=1 AND category_name='0' limit $start, $limit"; $s=mysql_query($query); Quote Link to comment https://forums.phpfreaks.com/topic/238059-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1223341 Share on other sites More sharing options...
rabesh Posted June 1, 2011 Author Share Posted June 1, 2011 Thanks alot Pikachu2000...my problem is solved Error in qotation mark.... Any way thanks alot to Pikachu2000 specially and other who help me indirectly as well as the owner of this site... Quote Link to comment https://forums.phpfreaks.com/topic/238059-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1223347 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.