Jump to content

Recommended Posts

<?
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 ?

Link to comment
https://forums.phpfreaks.com/topic/249982-while-help/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/249982-while-help/#findComment-1282996
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.