Re: Output errors

From: Date: Tue, 22 Oct 2002 17:29:38 +0000
Subject: Re: Output errors
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-22586@lists.php.net to get a copy of this message
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: [PHP-DB] 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 > >

« previous php.db (#22586) next »