If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > PHP Combo Box

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-04-09, 21:22
christyxo christyxo is offline
Registered User
 
Join Date: Oct 2003
Location: London
Posts: 291
Question PHP Combo Box

Hi,

I'm trying to convert something I originally done in ASPX with MS Access, into a PHP and MySQL web page but I'm having a little difficulty with a combo box.

What I want to do is retrieve a list of table names and place them into a combo box. This works fine in Access using the following;

SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name)<>'MSysObjects') AND ((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645) AND ((MSysObjects.Type) In (1,4))) ORDER BY MSysObjects.Name;

After converting this code into my PHP strings my combo boxes are coming out blank. Could someone please take a look and tell me if either something is wrong with my code, or if the SQL string above doesn't work in MySQL. In either case an option to rectify this would really help. Note that the connection strings are correct, it's only from $result and below that I'm not sure about

<select name="TranslateFrom" id="TranslateFrom">
<?php
mysql_select_db ("MyDatabase", $con);
$result = mysql_query("SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name)<>'MSysObjects') AND ((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645) AND ((MSysObjects.Type) In (1,4))) ORDER BY MSysObjects.Name");

while($row = mysql_fetch_array($result))

{
echo "<option value =" . $row['Name'] . "> " . $row['Name'] . " </option>";
}

?>
</select>
Reply With Quote
  #2 (permalink)  
Old 11-05-09, 02:14
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
have you checked that the SQL returns anything
hace you checked the MYSQL_ERRNO and/or MYSQL_ERROR functions

my suspiscion is that you are trying to access the system objects in a MySQL database using syntax / column or table names from an Access/JET database. the system objects in a MySQL db is in a databse called 'information_schema'. I'd suggest you get a copy of a suitable SQL query tool such as MySQL Query browser. there are other tools such as Heidi SQL
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 11-26-09, 07:01
Philip Montero Philip Montero is offline
Registered User
 
Join Date: Sep 2009
Posts: 7
re:

First, please call the element what it is. It is a called a select element.
<select name="pickme">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>

On the server side, you look for the name and value pair. It also depends on whether this is a POST or GET operation. GET, the name value pairs are visible in a URL, POST the name value pairs are sent directly to the server.

_________________
Absolute Steal.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On