Re: Newbie: Images refs not loading (Broken Icons) How to?

From: Date: Tue, 13 Feb 2001 03:59:10 +0000
Subject: Re: Newbie: Images refs not loading (Broken Icons) How to?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-39328@lists.php.net to get a copy of this message
Yes SIR! Steve! THIS IS WORKING NOW! MANY... MANY... MANY... THANKS FOR YOUR CODE! As a newbie... I have been working so hard on this one... You noticed that I have a lot of reading to do... Best regards, Merci encore, (Thanks again,) Yves At 22:41 -0500 12/02/2001, Steve Werby wrote:
"Malouin Design Graphique" <lists@malouin.qc.ca> wrote:
Is there anything wrong with this code below? Any help or fix to this code would be very much appreciated.
Let's take a look.
$db = mysql_connect("www.server.com", "root", "password"); mysql_select_db("db_name", $db); $sql = "select * from table_name order by 'date'"; $sql = "select * from table_name";
The second $sql overwrites the first so hopefully you didn't want the first.
$result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { print("<tr><td bgcolor=\"#003399\">"); printf("<img src=\"$indice_url\">%s</td></tr>\n", $row["indice_url"]);
Where is $indice_url being set? You call it in printf() but it was not previously set in your code. I think you just don't understand how to properly use printf() and since you're not really using it to format a string, like it's intended to be used I'm not going to bother to explain how to use it. I have an idea what you're trying to do, but in my opinion printf(%s, $var) is a horrible way to pull data from a query result so instead of showing you how to fix it, I'll show you a better way. Why not do something like: $result = mysql_query( $sql ); while ( $row = mysql_fetch_array( $result ) )
    {
    echo "<tr><td><img src=\"$row[indice_url]\">$row[indice]</td></tr>\n";
    }
-- Steve Werby COO 24-7 Computer Services, LLC Tel: 804.817.2470 http://www.247computing.com/
-- ------------------------ Malouin Design Graphique http://www.malouin.qc.ca Québec (Québec) CANADA

« previous php.general (#39328) next »