|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Creating drop dpwn menu with data from MySQL
I am trying to populate a drop down menu with data from MySql in WML using PHP. I can create a normal drop down meu with static data and I can create a normal PHP drop down menu, but can't seem to get the combination of drop-down with dynamic data in WML.
Here is my code. .....Database connections Code:
$query = "SELECT distinct LocalCustomer
FROM framerelay
ORDER BY localcustomer";
$result = @mysql_query($query);
if (mysql_num_rows($result) > 0) :
while ($row = mysql_fetch_array($result)) :
print "<select>";
$localcustomer = $row[LocalCustomer];
print "<option value='$localcustomer'>$localcustomer</option>";
endwhile;
print "</select>";
endif;
?>
Thanks |
|
#2
|
||||
|
||||
|
Is the $result actually getting any results?
Also Code:
print "<select>";
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. ![]() __________________ |
|
#3
|
||||
|
||||
|
Code:
$query = "SELECT distinct LocalCustomer
FROM framerelay
ORDER BY localcustomer";
$result = @mysql_query($query);
print "<select>";
if (mysql_num_rows($result) > 0) :
while ($row = mysql_fetch_array($result)) :
$localcustomer = $row[LocalCustomer];
print "<option value='$localcustomer'>$localcustomer</option>";
endwhile;
print "</select>";
endif;
?>
|
|
#4
|
|||
|
|||
|
Hi Ricta,
I tried that already since I use that in my normal php scripts but I get this error when using it as WML. XML parsing failed: not well-formed (Line: 6, Character: 2513) |
|
#5
|
||||
|
||||
|
oops.
thats right.. you need a <p> and </p> around printed stuff. Code:
$query = "SELECT distinct LocalCustomer
FROM framerelay
ORDER BY localcustomer";
$result = @mysql_query($query);
print "<p><select></p>";
if (mysql_num_rows($result) > 0) :
while ($row = mysql_fetch_array($result)) :
$localcustomer = $row[LocalCustomer];
print "<p><option>value='$localcustomer'>$localcustomer</option></p>";
endwhile;
print "<p></select></p>";
endif;
?>
try that. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Mobile Programming > Creating drop dpwn menu with data from MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|