ctcp Posted October 28, 2011 Share Posted October 28, 2011 <? mysql_connect("$db_host","$db_username","$db_password"); mysql_select_db("$db_name"); $query=mysql_real_escape_string($_GET['']); $query_for_result=mysql_query("SELECT * FROM $db_tb_name WHERE $db_tb_atr_name like '%".$query."%' LIMIT 0, 1 "); //echo "<h2>Search Results</h2><ol>"; while($data_fetch=mysql_fetch_array($query_for_result)) { echo "<li>"; echo "Order ID | #03355" . $data_fetch['id']; echo "</li><hr/>"; echo "<li>"; echo "URL | " . substr($data_fetch[$db_tb_atr_name], 0,160); echo "</li><hr/>"; echo "<li>"; echo "Order added | " . substr($data_fetch['date_added'], 0,10); echo "</li><hr/>"; echo "<li>"; echo "Credits | " . $data_fetch['total_credits']; echo "</li><hr/>"; echo "<li>"; echo "Available | " . $data_fetch['available_credits']; echo "</li><hr/>"; echo "<li>"; echo "Total Likes | " . $data_fetch['total_likes']; echo "</li><hr/>"; echo "</ol>"; $c=$data_fetch['total_credits']; $l=$data_fetch['total_likes']; $stats = $l / $c * 100 ; //echo "$stats % Complete"; //echo $c; //echo $l; include('includes/progress.php'); $progress6 = new Progress(); //echo "<li>"; //echo "Campaign progress $stats %"; $progress6->percent = $stats . "% Campaign progress"; $progress6->width = 800; $progress6->height = 22; $progress6->style = "image"; $progress6->makeBar(); } $result_1=mysql_query("SELECT $db_tb_name FROM $db_name"); while($row=mysql_fetch_array($result_1)) //line 76 { echo "Order ID | #" . $row['id']; } mysql_close(); } ?> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/89/7774789/html/xxx/like/clientstats.php on line 76 what is wrong here ? Quote Link to comment https://forums.phpfreaks.com/topic/249982-while-help/ Share on other sites More sharing options...
ManiacDan Posted October 28, 2011 Share Posted October 28, 2011 mysql_query returns false when the query fails. mysql_fetch_array expects a mysql resource, and will throw this error when it receives a false. Your query is wrong. Look at the line above the error. That query is missing a field list. Quote Link to comment https://forums.phpfreaks.com/topic/249982-while-help/#findComment-1282996 Share on other sites More sharing options...
ctcp Posted October 28, 2011 Author Share Posted October 28, 2011 thank you mate Quote Link to comment https://forums.phpfreaks.com/topic/249982-while-help/#findComment-1282998 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.