Re: Building Dynamic Value list using ohp

From: Date: Wed, 26 Sep 2001 15:08:31 +0000
Subject: Re: Building Dynamic Value list using ohp
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-68878@lists.php.net to get a copy of this message
Sheridan, I added the error stuff (adding an else bit) but when I went to my browser, I got the same resulting error I've always had. I have tried pasting the select statement striaght into MySQL_Front and I get my nice neat list. So it doen't look like a SQL problem. Head banging off wall right now. George ----- Original Message ----- From: "Sheridan Saint-Michel" <webmaster@foxjet.com> To: "George Pitcher" <fmdev@yahoo.co.uk>; <php-general@lists.php.net> Sent: Wednesday, September 26, 2001 4:00 PM 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 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.general (#68878) next »