1. this: print("<option value=\"$row[0]\">$row[0]</option>"); should be this: print("<option value=\"{$row[0]}\">{$row[0]}</option>"); or like this: echo '<option value="'.$row[0].'">'.$row[0].'</option>'); The reason for it is that within double quote you can parse for 'simple' variables only (es: $var, not $var[]). Otherwise it gives you a parse error. 2. this: mysql_connect ('localhost', 'root', 'monty'); better be this: mysql_connect ('localhost', '****', '****'); // for security reasons obviously, you don't wanna give the password our to the group, even so it is your local server (you might not be original with the password on production machines, no?) Hope it helps, Maxim Maletsky PHPBeginner.com -----Original Message----- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: mercoledì 26 settembre 2001 15.31 To: [EMAIL PROTECTED] Subject: [PHP] Building Dynamic Value list using ohp Hi all, I'm having a problem with dynamically building a value list. My code: <?php mysql_connect ('localhost', 'root', 'monty'); mysql_select_db ('Heronsql'); $query = ("select HEI from heronuser"); // LINE 22 on original script $result = mysql_query($query, $mysql_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>"); } } ?> But this generates: "Parse error: parse error in c:\program files\apache group\apache\htdocs\bizflyers\login.php on line 22" Any suggestions? Regards George _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Building Dynamic Value list using ohp
Maxim Maletsky \(PHPBeginner.com\) Wed, 26 Sep 2001 06:49:13 -0700
- [PHP] Building Dynamic Value list using... George Pitcher
- Re: [PHP] Building Dynamic Value l... George Pitcher
- Re: [PHP] Building Dynamic Val... Derek Mailer
- Re: [PHP] Building Dynamic Value l... Derek Mailer
- Re: [PHP] Building Dynamic Val... Steve Cayford
- Re: [PHP] Building Dynamic Value l... Maxim Maletsky \(PHPBeginner.com\)
- Re: [PHP] Building Dynamic Value l... George Pitcher
- Re: [PHP] Building Dynamic Value l... Sheridan Saint-Michel
- Re: [PHP] Building Dynamic Val... George Pitcher
- RE: [PHP] Building Dynamic Val... Maxim Maletsky \(PHPBeginner.com\)
- Re: [PHP] Building Dynamic Value l... Derek Mailer
- RE: [PHP] Building Dynamic Val... Maxim Maletsky \(PHPBeginner.com\)
- Re: [PHP] Building Dynamic Val... George Pitcher
- RE: [PHP] Building Dynamic Value l... Philip Olson
- Re: [PHP] Building Dynamic Val... Evan Nemerson