weird reverse

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

weird reverse

Post by ol4pr0 »

Now i dont have a clue why the following occurs.

$price;
$description

i checked both of them in my db
( description has desc and price has the price )

however the echo displays the reverse.

so <u>$price</u> wouldnt underline the $price but it will underline the $description

here is the code .. ( is it the code or db ? and the solution ;-))

Code: Select all

$result = mysql_query("SELECT id, price, description FROM modems ORDER by id");
while (list($id, $description, $price) = mysql_fetch_row($result)) {
    echo " \n";
?>
	<table cellpadding=2 width=100% cellspacing=1 border=0>
	<TR>
	<TD align='left' BGCOLOR='#eeeeee'><B><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>
	<?php echo $price;?>
	</font></B>
	<TD align='right' width="47" BGCOLOR='#B3B3B3'><B><font color="white" size='1' face='Verdana, Arial, Helvetica, sans-serif'>
	<?php echo $description; ?>
	</font></B></TD>
	</font></B></TD>
	</TR>
	</TABLE>
	<?
}

echo "<p>";
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

while (list($id, $description, $price) needs to be
while (list($id, $price, $description) as that's the order they are coming out of the db (the order in the SELECT statement).
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

yea.. that reverses it so that i have te reverse the <?echo $... ?> also hehe....

tried that.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Got it... thanks for the hint tho... did make me mess around a little bit more knowing i was on the right track ;_)
Post Reply