Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

JQuery Mobile - Select Menu From MySql Table

Posted on 2013-01-22
3
Medium Priority
?
1,136 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 560 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

636 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