Solved

JQuery Mobile - Select Menu From MySql Table

Posted on 2013-01-22
3
1,071 Views
Last Modified: 2013-01-22
Hi,

I take the data from a table and display it in a select menu component, I tried the code below but I get only blank lines worthless.
Is there any example or you can fix my code?
Thank you all,
Regard

			<select name="cliente" id="cliente" class="select" data-inline="false" data-native-menu="false">
			<option>Seleziona Cliente</option>
			<?php
                        $query = mysql_query("SELECT * FROM clienti ORDER BY RagioneSociale desc");
                        while($data = mysql_fetch_assoc($query)) {
                        ?>
                        <option value="<?php echo $data["RagioneSociale"]; ?>><?php echo $data["RagioneSociale"]; ?>"</option>
                        <?php } ?>
			</select>

Open in new window

0
Comment
Question by:danz67
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 140 total points
ID: 38804453
tyr like this

<select name="owner">
<?php
$sql = mysql_query("SELECT username FROM users");
while ($row = mysql_fetch_array($sql)){
echo "<option value=\"owner1\">" . $row['username'] . "</option>";
}
?>
</select>

refer
http://stackoverflow.com/questions/8022353/how-to-populate-html-dropdown-list-with-values-from-database
0
 
LVL 29

Expert Comment

by:chilternPC
ID: 38804471
it may depend on what the data is in the $data array, is it a string or an integer?

try replacing:

echo $data["RagioneSociale"]

with

echo gettype($data["RagioneSociale"]);

also are you sure there is data in the array?
0
 

Author Closing Comment

by:danz67
ID: 38804486
Best Solution for me
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question