Page 1 of 1

weird reverse

Posted: Tue Mar 09, 2004 1:56 pm
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>";

Posted: Tue Mar 09, 2004 1:58 pm
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).

Posted: Tue Mar 09, 2004 2:06 pm
by ol4pr0
yea.. that reverses it so that i have te reverse the <?echo $... ?> also hehe....

tried that.

Posted: Tue Mar 09, 2004 2:07 pm
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 ;_)