Re: Output errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The faulty line is:

            else { echo '<p><img src=$image width="201"
height="160"></p></td>'; }

$image does not interpolate (surrounded by single quotes)

You must write:

            else { echo '<p><img src="{$image}" width="201"
height="160"></p></td>'; }

It is good hygiene to brace variables in somehow complicated statements like
these. Keeps life easier.

HTH
Ignatius
____________________________________________
----- Original Message -----
From: <Bzdpltd@aol.com>
To: <php-db@lists.php.net>
Sent: Tuesday, October 22, 2002 7:15 PM
Subject:  Output errors


> Hi there,
>
> I am working to a deadline, and missed something probably simple here.
>
> I have this code, and as I have an if else statement inbetween, it is not
outputting the image name from the database, and rather just how I put the
code in ie. $image.
>
> Could someone see where I am going wrong. Help much appreciated. Code
selection below.
>
> if (mysql_num_rows($sql_result) ==0)
> {
> echo ("  \n");
> }
> else {
>         while ($row = mysql_fetch_array($sql_result)){
>   $title = $row["title"];
>   $description = $row["description"];
>   $image = $row["image"];
>
>         echo ("<tr> \n");
>         echo ("<td width=\"72%\" valign=\"top\"><h3>$title</h3> \n");
>         echo ("<p>$description</p></td> \n");
>         echo ("<td width=\"28%\" valign=\"top\">  \n");
>             if ($image =='NULL') { echo ''; }
>             else { echo '<p><img src=$image width="201"
height="160"></p></td>'; }
>         echo ("</tr> \n");
>         }}
>
>
> Thanks
>
> Barry
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux