query problem
Posted: Fri Feb 21, 2003 3:10 am
I can't figure out why this does not work.
Very simple, if an id gets passed in the url, the individual artist's info is shown otherwise a list of all artisits. The list works fine. Once I click on the artist, I can see(and I tested) that the id is passed but on reload I get an "Warning: Supplied argument is not a valid MySQL result resource in /Users/adam/Sites/globalparty3/lib/labelvirtuel/artists/index.php on line 6
" error.
The code:
<p>
<?php
// show individuel artist info if id is available, otherwise a list of all artists
if ($id) {
$result = mysql_query("SELECT * FROM artistLV WHERE artist_id = '$id'");
$myrow = mysql_fetch_array($result);
echo $myrow['name'];
echo $myrow['descripEng'];
} else {
?>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<?php
$result2 = mysql_query("SELECT * FROM artistLV LEFT JOIN images ON artistLV.imageId = images.id_images ORDER BY artistLV.artist_id ASC");
while($myrow = mysql_fetch_array($result2)) {
?>
<tr>
<!-- image -->
<?php
if ($myrow['imageId']=='0') {
echo "<td> </td>";
} else {
?>
<td valign="top" width="85"><img src="../images/<?php echo $myrow['thumbUrl']; ?>" width="<?php echo $myrow['thumbWidth']; ?>" height="<?php echo $myrow['thumbHeight']; ?>" alt="<?php echo $myrow['alt']; ?>" /></td>
<?php
}
?>
<td width="10"> </td>
<td width="500" valign="top"><a href="artists/index.php?id=<?php echo $myrow['artist_id']; ?>"><?php echo $myrow['name']; ?></a> <?php echo $myrow['country']; ?></td>
</tr>
<tr><td colspan="3"> </td></tr>
<?php
}
?>
</table>
<?php
}
?>
</p>
It must be something obvious but I can't find it.
thanks.
Very simple, if an id gets passed in the url, the individual artist's info is shown otherwise a list of all artisits. The list works fine. Once I click on the artist, I can see(and I tested) that the id is passed but on reload I get an "Warning: Supplied argument is not a valid MySQL result resource in /Users/adam/Sites/globalparty3/lib/labelvirtuel/artists/index.php on line 6
" error.
The code:
<p>
<?php
// show individuel artist info if id is available, otherwise a list of all artists
if ($id) {
$result = mysql_query("SELECT * FROM artistLV WHERE artist_id = '$id'");
$myrow = mysql_fetch_array($result);
echo $myrow['name'];
echo $myrow['descripEng'];
} else {
?>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<?php
$result2 = mysql_query("SELECT * FROM artistLV LEFT JOIN images ON artistLV.imageId = images.id_images ORDER BY artistLV.artist_id ASC");
while($myrow = mysql_fetch_array($result2)) {
?>
<tr>
<!-- image -->
<?php
if ($myrow['imageId']=='0') {
echo "<td> </td>";
} else {
?>
<td valign="top" width="85"><img src="../images/<?php echo $myrow['thumbUrl']; ?>" width="<?php echo $myrow['thumbWidth']; ?>" height="<?php echo $myrow['thumbHeight']; ?>" alt="<?php echo $myrow['alt']; ?>" /></td>
<?php
}
?>
<td width="10"> </td>
<td width="500" valign="top"><a href="artists/index.php?id=<?php echo $myrow['artist_id']; ?>"><?php echo $myrow['name']; ?></a> <?php echo $myrow['country']; ?></td>
</tr>
<tr><td colspan="3"> </td></tr>
<?php
}
?>
</table>
<?php
}
?>
</p>
It must be something obvious but I can't find it.
thanks.