Re: Building Dynamic Value list using ohp

From: Date: Wed, 26 Sep 2001 15:00:58 +0000
Subject: Re: Building Dynamic Value list using ohp
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-68876@lists.php.net to get a copy of this message
----- Original Message ----- From: "George Pitcher" <fmdev@yahoo.co.uk> To: "Maxim Maletsky (PHPBeginner.com)" <php-general@phpbeginner.com>; <php-general@lists.php.net> Sent: Wednesday, September 26, 2001 9:42 AM Subject: Re: [PHP] Building Dynamic Value list using ohp > Thanks for everyone's help but this is still failing to work. > > Revised code is: > > <?php > $link = mysql_connect ('localhost', '****', '****') > or die ("Could not select db"); > mysql_select_db ('Heronsql') > or die ("Could not connect"); > $query="select distinct HEI from heronuser"; > $result = mysql_query ($query); // I've also tried with ($query, $link) > if(mysql_num_rows($result)) { > // show all HEIs as options in select form > while($row = mysql_fetch_row($result)) > { > print("<option > value=\"{$row[0]}\">{$row[0]}</option>"); > } > } > mysql_close($link); > ?> > > Any more suggestions (please)? > > George I don't see anything glaringly wrong with your code. I would change this: $result = mysql_query ($query) into: if( !($result = mysql_query ($query)) ) echo "Error: " . mysql_error() . "<BR>"; as I find that most of my errors in something this simple are in something fairly simple with the query itself (misspelled table or something). also make sure that if you copy your query and paste it directly into MySQL that it works. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com

« previous php.general (#68876) next »