Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

mysql_fetch_array() expects parameter 1 to be resource, boolean given

$
0
0

i'm sorry im newbie of php...

i found this...

http://forums.phpfreaks.com/topic/181256-solved-warning-mysql-fetch-array-expects-parameter-1-to-be-resource/

but in my case i didn't use $result in my while....why it doesnt work? somebody help me...thx before 

 

ERROR on line 17Attached File  coba.php   1.92KB   0 downloads

 

$total_record = mysql_fetch_array(mysql_query('SELECT COUNT(`product_id`) AS rows FROM `product`' )); //ERROR
$total_record=$total_record['rows'];
 
$total_page=ceil($total_record/$per_page);
if($page>$total_page) $page=$total_page;
       
$query_exec = get_all_product();
echo "<table align='center'>";
echo "<tr align=center>";
echo"<th>Image</th><th>Name</th><th>About</th><th>Price</th><th>Stoks</th><th>Category</th>";
echo "</tr>";
while ($row = mysql_fetch_assoc($query_exec)){
echo "<tr align=center>";
echo"<td><img src='".$row['product_image']."'/><td>";
echo "<td>" .$row['product_name']. "</td>";
echo "<td>" .$row['product_description']. "</td>";
echo "<td>" .$row['product_price']. "</td>";
echo "<td>" .$row['product_stok']. "</td>";
echo "<td>" .$row['category_name']. "</td>";
echo "<td><input type=button value=delete name='delete' onClick = lemparproduct('".$row['product_id']."')></td>";
echo "<td><input type='hidden' id='idproducthidden' value='".$row['product_id']."'>
 <input type=button value=update name='updates' onClick = wew('".$row['product_id']."')></td>";
echo "</tr>";}
echo "</table>";
 
echo 'page : <select onchange="window.location=\'?p=\'+this.value">';
for($i=1;$i<=$total_page;$i++) 
echo '<option' . ( $i==$page ? ' selected' : '' ) . '>' . $i . '</option>';
echo '</select><br>';

Viewing all articles
Browse latest Browse all 13200

Trending Articles