Networking, Programming and Graphics Tutorials

AJAX PHP MySQL Select Query [1/3]

Type: Code Networking, Programming and Graphics Tutorials
AJAX PHP MySQL Select Query
Level: Intermediate Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
AJAX PHP MySQL Select Query
Date: 2008-Aug-06
AJAX PHP MySQL Select Query
Visited: 2560 times
AJAX PHP MySQL Select Query
Rating: AJAX PHP MySQL Select Query
AJAX PHP MySQL Select Query
Author: Ivory Morhuld

We will continue with our AJAX Tutorials and make small AJAX Application using AJAX PHP MySQL Query to edit data in MySQL Database.

Lets say we have some MySQL table with employs and we have to list their names in drop-down <select> menu and when we select someone from the list, personal data will be displayed in table where we can edit the data.

First we have to make HTML page where the drop-down list will be generated from MySQL Database by PHP server side and also we have to place some <div></div> tags where will display employs data.

Lets give name 'index.php' for this file.

<html>
<head>
</head>
<body>
<select>
    <option>Select employ</option>
    <?php
    mysql_connect
('localhost','user','pass');
    
mysql_select_db('employ');
    
$query="select id, name from employ order by name asc";
    
$result=mysql_query($query);
    while(list(
$id$name)=mysql_fetch_row($result)) {
        echo 
"<option value=\"".$id."\">".$name."</option>";
    }
    
?>
</select>
<div></div>
</body>
</html>
Networking, Programming and Graphics Tutorials - AJAX PHP MySQL Select Query [1/3] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: AJAX PHP MySQL Select Query  select query mysql using ajax  given a select query,output tables present in query using php mysql  select ajax query  ajax query on select  ajax query on select  select query ajax  select query ajax  select query ajax php  php select query ajax