Hey... new to the list, but didn't have time to lurk and watch the traffic,
kind of in a bind here. I apologize in advance if I do something wrong...
Using this code:
<?php
$link = mysql_connect()
or die("Could not connect");
mysql_select_db("mydb") or die("Could not select database");
$result = mysql_query("SELECT * FROM cars WHERE year=1991");
extract(mysql_fetch_array($result));
while ($row = mysql_fetch_object($result)) {
$generation = $row->generation;
$year = $row->year;
$owner = $row->owner;
$email = $row->email;
$pic1 = $row->pic1;
$tmb1 = $row->tmb1;
printf("<img src='%s'><br>", $pic1);
printf("<small>%s</small><br>",$generation);
printf("<b>%s</b><br>",$year);
printf("%s<br>",$owner);
printf("<a href=mailto:'%s'>%s</a><p>", $email,
$email);
printf("<a href='%s'><img src='%s' border=0></a><p>",
$pic1, $tmb1);
}
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
?>
I'm successfully able to retrieve and display information for year='1991'.
It works great. However, if I replace '1991' with any other year that I KNOW
there's a matching record for, I get no results. So if I were to replace
year='1991' with year='1990', no results would be produced although the same
query given directly in MySQL will give results. Make sense? This same
problem happens with other fields too, it seems really selective. I can use
WHERE color='red' and get results, but color='black' returns nothing,
although there are matching records.
Any ideas? I need to get this fixed but I'm not sure what's wrong!
Thanks in advance,
Jason
(PHP 4.1.2 Win32)
(MySQL 3.23)
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php