error query
| From: | Mark Sweeney | Date: | Fri, 01 Mar 2002 23:16:41 +0000 |
| Subject: | error query | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-12393@lists.php.net to get a copy of this message | ||
Sorry to bother, but I am having a severe problem with this (probably stupidly) flawed code.
It is part of a script to call descriptions for images along with their filenames from a mysql
database. trouble is, it doesnt work, and it claims that I have a syntax error near "LIMIT
10"
The code is below, and i would be very thankful if anyone could point out jsut hwat I am doing wrong
$newpics = mysql_query("SELECT ID, alt FROM $MID LIMIT 10");
if (!$newpics) {
echo( "<p>Error performing query " . mysql_error() . "</p>" );
exit();
}
while ( $row = mysql_fetch_array($newpics) ) {
$id=$row[ID];
$alt=$row[alt];
$alt = htmlspecialchars($alt);
$alt = eregi_replace("\[b]","<b>",$alt);
$alt = eregi_replace("\[/b]","</b>",$alt);
$alt = eregi_replace("\[i]","<i>",$alt);
$alt = eregi_replace("\[/i]","</i>",$alt);
echo("<a
href=\"viewer.php?title=$title&id=$id\">$alt</a><br>");
}
?>