bonjour,

sous wamp :
  • ma base s'appelle mabase
  • ma table s'appelle matable
  • j'ai 2 champs id (int) et nom (txt)



je cherche a afficher le nom de l'id=2
mais ca ne marche pas

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<?php
$i=2;
$db = mysql_connect('localhost', 'root', '');
 
 mysql_select_db('mabase',$db);
 $sql = 'SELECT id,nom FROM matable where id=$i';
 $req = mysql_query($sql);
 mysql mysql_close();
 
?>