rndilger
03-10-2007, 07:00 PM
Hello everyone, I have a quick PHP/MySQL syntax question.
<?php
if(isset($_GET['id'])){
$id = $_GET['id'];
echo "ID: ".$id;
$result = mysql_query("SELECT * FROM classifieds WHERE adid=$id");
while ($row = mysql_fetch_assoc($result)) {
echo "<img src='images/classifieds/$row[pictureid].jpg'>";
}
mysql_close($connect);
} else {
echo "<br><br><span class='bold'>We apologize, but you have reached this page in error.<br><br>Please use the navigation menu on the left to choose another main page.</span>";
}
?>
I've confirmed that I am receiving the id variable (i.e., I'm able to echo the correctly passed id). However, the MySQL query is not working. I'm guessing I've missed something small, but any assistance would be appreciated.
Thanks,
Ryan
<?php
if(isset($_GET['id'])){
$id = $_GET['id'];
echo "ID: ".$id;
$result = mysql_query("SELECT * FROM classifieds WHERE adid=$id");
while ($row = mysql_fetch_assoc($result)) {
echo "<img src='images/classifieds/$row[pictureid].jpg'>";
}
mysql_close($connect);
} else {
echo "<br><br><span class='bold'>We apologize, but you have reached this page in error.<br><br>Please use the navigation menu on the left to choose another main page.</span>";
}
?>
I've confirmed that I am receiving the id variable (i.e., I'm able to echo the correctly passed id). However, the MySQL query is not working. I'm guessing I've missed something small, but any assistance would be appreciated.
Thanks,
Ryan