Networking, Programming and Graphics Tutorials

MySQL PHP AJAX Query [1/3]

Type: Code Networking, Programming and Graphics Tutorials
MySQL PHP AJAX Query
Level: Intermediate Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
MySQL PHP AJAX Query
Date: 2008-Aug-03
MySQL PHP AJAX Query
Visited: 1721 times
MySQL PHP AJAX Query
Rating: MySQL PHP AJAX Query
MySQL PHP AJAX 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 - MySQL PHP AJAX Query [1/3] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: ajax mysql query  ajax php mysql query  Query su MySql con Ajax  ajax Query By Example? mySql  ajax query mysql  ajax mysql query  ajax mysql query  query mysql ajax  query ajax mysql  mysql query with ajax