Re: If else.. display no picture..
| From: | BAROILLER Pierre-Emmanuel | Date: | Sat, 05 Apr 2003 19:47:41 +0000 |
| Subject: | Re: If else.. display no picture.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142522@lists.php.net to get a copy of this message | ||
May be this line is wrong :
Echo Geen informatie beschikbaar;
may be use this instead...
echo 'Geen informatie beschikbaar';
no?
:)
regards.
<fkeessen@planet.nl> a écrit dans le message de news:
1425593.1049552432350.JavaMail.root@apps19.wxs.nl...
> 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
>