Build HREF list from database???

From: Date: Tue, 13 Feb 2001 04:54:48 +0000
Subject: Build HREF list from database???
Groups: php.general 
Request: Send a blank email to php-general+get-39338@lists.php.net to get a copy of this message
Hi - I want to print a list of numbers linked to URLs I create on the fly - something like this: table: ------------------- path pid ---------|--------- foo.jpg 1 bar.jpg 1 <?php include("db_connection_params.inc"); //all relevant database variables $sql="select path from table where pid =1"; //obvious $link_id = mysql_connect($host, $usr, $pass); //get connection handle $result = mysql_db_query($database, $sql, $link_id); $count = mysql_num_rows($result) or die ("no rows returned from $sql"); $i = 0; //initialze counter for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i;) { $path=$current_row[2]"; //database field position matched index number print "<a href = $path>$count</a><br>"; // } ?> so I want this to print: 1 (linked to foo.jpg) 2 (linked to bar.jpg) The problem is I'm getting a parse error on the "for" line. Any ideas? TIA, andrew

« previous php.general (#39338) next »