When I run this query, it works fine but the individual fields would pull out. Like ThumbFilePath and Title.
If I run the query with only one field like:
$result = mysql_query("select ThumbFilePath from artwork where SCID = $SCID") or die(mysql_error());
It works fine. Any ideas why I can’t pull the other fields?
<?php
$dbname = 'pdartist2';
$table = 'artowrk';
// query
$result = mysql_query("select AID, ThumbFilePath, Title, DisplayOrder from artwork where SCID = $SCID") or die(mysql_error());
while($row = mysql_fetch_row($result))
{
foreach($row as $cell)
{
echo "<div id='thumb_container'>";
echo "
<a href='gallery_detail.php?AID=$AID'>
<img src='http://markdinwiddie.com/PHP2012/$ThumbFilePath' title='Enlarge' alt='Enlarge' border='0'>
</a>
";
echo "$Title";
echo "</div>";
}
}
mysql_free_result($result);
?>
In general, you’ll ALWAYS need to dereference the columns you need. For example: