RE: [PHP] Building Dynamic Value list using ohp

From: Date: Wed, 26 Sep 2001 15:11:33 +0000
Subject: RE: [PHP] Building Dynamic Value list using ohp
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68880@lists.php.net to get a copy of this message
What error do you see, George? Maxim Maletsky www.PHPBeginner.com -----Original Message----- From: Sheridan Saint-Michel [mailto:webmaster@foxjet.com] Sent: mercoledì 26 settembre 2001 17.01 To: George Pitcher; php-general@lists.php.net Subject: Re: [PHP] Building Dynamic Value list using ohp ----- 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 -- 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 (#68880) next »