Re: Build HREF list from database???

From: Date: Tue, 13 Feb 2001 07:01:53 +0000
Subject: Re: Build HREF list from database???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39374@lists.php.net to get a copy of this message
you have an extra semicolon in the for statement it should be for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i) $path=$current_row[2]"; file://database field position matched index number print "<a href = $path>$count</a><br>"; // } hope that helps Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "andrew" <andrew@salamander.net> To: "PHP General" <php-general@lists.php.net> Sent: Tuesday, February 13, 2001 10:24 AM Subject: [PHP] Build HREF list from database??? > 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"); file://all relevant database variables > $sql="select path from table where pid =1"; file://obvious > $link_id = mysql_connect($host, $usr, $pass); file://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; file://initialze counter > > for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i;) > > > > $path=$current_row[2]"; file://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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#39374) next »