SilentPanther Posted November 27, 2013 Share Posted November 27, 2013 Hi there, basically someone gave me coding that brings up a dropdown menu from the mysql database, I can't get it to work, there's a few syntax errors and the dropdown list won't come up, anyone have any ideas? Any help would be greatly appreciated! The coding is below (it wouldn't let me upload it as a file :S ) http://pastebin.com/xRDdcinf Quote Link to comment https://forums.phpfreaks.com/topic/284332-dropdown-php/ Share on other sites More sharing options...
bashy Posted November 27, 2013 Share Posted November 27, 2013 Not sure if you coded this yourself but have you checked PHP errors and checked them? I can see one just skimming it, the code below (copied from yours) has errors. Firstly, where you getting $possible_city from? You also don't close the </option> tag? $possible_city doesn't have a closing ; foreach ($rows as $row) { $city = $row->city; ?> <option> <?php echo $possible_city ?> <?php //end loop through cities for pulldown results } ?> Quote Link to comment https://forums.phpfreaks.com/topic/284332-dropdown-php/#findComment-1460422 Share on other sites More sharing options...
SilentPanther Posted November 28, 2013 Author Share Posted November 28, 2013 Thanks for replying, The coding was originally made for use with postgresql, I was attempting to change it to mysql. I've corrected those errors you pointed out, still isn't working though This is the error I'm getting: "Parse error: syntax error, unexpected '':city'' (T_CONSTANT_ENCAPSED_STRING), expecting '(' in C:\wamp\www\pulldown_hotels.php on line 42"This is line 42 $query->$conn(array':city' => $city); Quote Link to comment https://forums.phpfreaks.com/topic/284332-dropdown-php/#findComment-1460551 Share on other sites More sharing options...
Fr3dr1k Posted January 20, 2014 Share Posted January 20, 2014 It schould be like this $query->$conn(array(':city' => $city)); array needs the ( ) to function. Quote Link to comment https://forums.phpfreaks.com/topic/284332-dropdown-php/#findComment-1465924 Share on other sites More sharing options...
PravinS Posted January 21, 2014 Share Posted January 21, 2014 check http://www.phpclasses.org/package/5927-PHP-Display-an-hierarchic-menu-stored-in-a-MySQL-table.html Quote Link to comment https://forums.phpfreaks.com/topic/284332-dropdown-php/#findComment-1465966 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.