Re: contents from a database

From: Date: Wed, 17 Jul 2002 00:09:28 +0000
Subject: Re: contents from a database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107988@lists.php.net to get a copy of this message
You need to use the concatenating assignment operator .= after $sub. The way you had it the variable $sub was getting assigned a new value each time through the while loop. The .= oprerator will add to the existing value of $sub each time through the loop. Try this: $query = "SELECT * FROM content WHERE section='$section' "; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $sub .= "<a href='index2.html?section=" . $res[section] . "&code=" . $res[code] . "'>" . $res[art_name] . "</a><br>\n"; } Good luck :-)

« previous php.general (#107988) next »