$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

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
  //
}

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>";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.