Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mysql=mysql_connect('localhost','root','')|| exit(mysql_error());
- $db=mysql_select_db('location');
- // Si on appelle le fichier sans passer d'argument, on arrête l'exécution.
- if(!isset($_GET['action']))
- exit();
- else
- $action = $_GET['action'];
- //Si on veut récupérer les appart
- if($action == 'getnom')
- {
- $query = 'SELECT DISTINCT nom FROM locataire';
- $result = mysql_query($query);
- //Permet de vérifier qu'on a des résultats retournés
- if(mysql_num_rows($result))
- {
- while ($ligne = mysql_fetch_row($result))
- {
- $retour .= '<option value="'.$ligne['nom'].'">'.$ligne['nom'].'</option>';
- }
- echo $retour;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment