R: [PHP-WIN] error query
| From: | Darvin Andrioli | Date: | Fri, 01 Mar 2002 23:49:09 +0000 |
| Subject: | R: [PHP-WIN] error query | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12394@lists.php.net to get a copy of this message | ||
Hi Mark,
what is the value of $MID? Have it the table name or any other unespected
value?
Cheers
Darvin
> -----Messaggio originale-----
> Da: Mark Sweeney [mailto:mark@nintendoodle.com]
> Inviato: sabato 2 marzo 2002 0.17
> A: php-windows@lists.php.net
> Oggetto: [PHP-WIN] error query
>
>
> 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>");
> }
> ?>
>