0
$query  = "SELECT * FROM image_share WHERE to='$username'";
$result = mysql_query($query);

while($row = mysql_fetch_assoc($result))
{
    echo '<tr> 
<td width="100%" align="left" valign="top"> 
<div style="border-bottom:1px solid #6F6F6F;"><span style="color:#C0B184;"><a href=""><img src="'.$row['image_sharelink'].'" width="150" height="137"/></a></span><br/>
<br/> 
</td>
</tr>';
}

cant figure out why it wont work.
I got my error display on E_ALL

mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by IIM
0

Are you connecting to the database with a mysql_connect()?

You can echo out your $query variable, copy the SQL command and run the query directly against the database. This will return a specific error if there is a problem with the SQL statment.

You should also check the validity of the mysql_query() $result

if ($result = mysql_query($query)) {
  //
  // ToDo: Process Result Set
  //
} else {
  //
  // ToDo: Report Error
  //
}
0

Instead of "mysql_fetch_assoc" ...try using "mysql_fetch_array"
It's better to use the code this way....
.....
Also

$query  = "SELECT * FROM image_share WHERE to='$username'";
$result = mysql_query($query);
 
while($row = mysql_fetch_array($result))
{
    echo "<tr> 
<td width='100%' align='left' valign='top'> 
<div style='border-bottom:1px solid #6F6F6F;'><span style='color:#C0B184;'><a href=''><img src='".$row['image_sharelink']."' width='150' height='137'/></a></span><br/>
<br/> 
</td>
</tr>";
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.