Re: If else.. display no picture..
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: If else.. display no picture.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142510@lists.php.net to get a copy of this message | ||
I would help if you told us which line the error was on
On Sat, 5 Apr 2003 fkeessen@planet.nl wrote:
> Hi,
>
> I'm trying to do the following.. When $stadpict is filled in it must display the picture
> (only the path to the picture is stored in Mysql). But when the string ($stadpict) is empty then it
> must not display the picture (and also not display a box with a red cross in it (can't display
> picture! ;>). The only thing i'm getting is an error message...
>
> Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
>
> Code;
> <?
> // includes
> include("../conf/config.php");
>
> // open database connection
> $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
>
> // select database
> mysql_select_db($db) or die ("Unable to select database!");
> $stedenid=$_GET['stedenid'];
>
> // generate and execute query
> $query2 = "SELECT stedenid, naamstad, stadomschrijvk, stadpict FROM steden WHERE stedenid
> = $stedenid";
> $result2 = mysql_query($query2) or die ("Error in query: $query2. " . mysql_error());
> $row2 = mysql_fetch_object($result2);
> if (mysql_num_rows($result2) > 0)
> {
> ?>
>
> <font class="bold"><? echo $row2->naamstad; ?> </font>
> <br><br><? echo $row2->stadpict;
> ?>
>
> </td>
> </tr>
> </table>
> <table cellspacing="0" width="405" cellpadding="0"
> border="0">
> <tr style="padding-top:10">
> <td width="139" valign="top" style="padding-left:20">
> <?
> while($row->$stadpict > 0)
> {
> ?>
> <img src="../steden/images/<? echo $row->stadpict; ?>"
> border="0" width="108" height="160" alt=""></td>
> <?
> }
> ?>
> <td width="266" valign="top"
> style="padding-right:10;padding-left:10"><? echo $row2->stadomschrijvk;
> }
> else
>
> {
> Echo Geen informatie beschikbaar;
> }
> ?>
>
>
> Thanks for helping me out!
>
> Frank
>
>