Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/284332-dropdown-php/
Share on other sites

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
               }
?>
Link to comment
https://forums.phpfreaks.com/topic/284332-dropdown-php/#findComment-1460422
Share on other sites

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);

 

Link to comment
https://forums.phpfreaks.com/topic/284332-dropdown-php/#findComment-1460551
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.