Re: HELP with displaying mysql properly

From: Date: Tue, 19 Dec 2000 17:08:37 +0000
Subject: Re: HELP with displaying mysql properly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-31072@lists.php.net to get a copy of this message
Sefton: > printf("<tr> > <td><font face=arial size=2 color=#FFFFFF>%s</font></td> > <td width=130><img src=si/%s.gif></td> > <td><font face=arial size=2 color=#FFFFFF>%s</font></td> > <td><font face=arial size=2 color=#FFFFFF>%s</font></td> > <td><font face=arial size=2 color=#FFFFFF>%s</font></td> > <td><font face=arial size=2 color=#FFFFFF>%s</font></td> > <td><font face=arial size=2 color=#FFFFFF>%s</font></td> > <td><font face=arial size=2 color=#FFFFFF>$%s</font></td> > </tr>\n", $myrow[0], $myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], > $myrow[6], $myrow[9], $myrow[10]); > ... > The stock number & photo are always the same ie Vehicle stock number 3096 > and image file 3096.gif But if it is not there we usually subtitute it for > 1.gif This is because the vehicle has been unavailable for us to take the > photo. Substitute the following for your printf statement... echo "<tr><td>$myrow[0]</td><td width=130>"; if (file_exists("./si/$myrow[0].gif")) { echo "<img src=\"si/$myrow[0].gif\">"; } else { echo "<img src=\"si/1.gif\">"; } echo "</td><td>$myrow[1]</td><td>$myrow[2]</td><td>$myrow[3]</td>"; echo "<td>$myrow[4]</td><td>$myrow[6]</td><td>\$$myrow[9]</td></tr>\n"; By the way, I deleted the <font> garbage. Setting font colors and sizes is poor practice. Makes things hard to read for some folks. Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#31072) next »