Bonjour , je suis actuellement en train de créer mon site en PHP / MYSQL ...
Donc ca c'est la page ' PRINCIPALE ' de mon site web :
---------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<head><title>Formulaire de saisie utilisateur </title></head>
<body>
<h1><img src="../../../Users/BirdHouse/Documents/Lotto !/Les logos/Weezo_LOGO.png" width="450" height="100" alt="Weezo : Tu te connectes , tu cliques , tu gagnes" /></h1>
<p><img src="../../../Users/BirdHouse/Documents/Lotto !/Les logos/INSCRIPTION.png" width="200" height="70" alt="Inscription" /></p>
<form action="Teste[PHP!].php" method="post" name="inscription" >
<p>:<img src="../../../Users/BirdHouse/Documents/Lotto !/Les logos/Pseudo.png" width="80" height="25" alt="pseudo" />
<input type="text" name="id"/> <br/>
:<img src="../../../Users/BirdHouse/Documents/Lotto !/Les logos/Passe.png" width="70" height="25" />
<input type="password" name="passe"/> <br/>
:
<img src="../../../Users/BirdHouse/Documents/Lotto !/Les logos/Email.png" width="65" height="25" />
<input type="text" name="mail"/>
<br/>
<input type="submit" name="valider" value="Inscription"/>
</p>
</form>
<form action="visu.php" method="post" name="inscription" >
pseudo :
<input type="text" name="id2"/> <br/>
passe :
<input type="password" name="passe2"/> <br/>
<br/>
<input type="submit" name="valider" value="Inscription"/>
</p>
</form>
<p><img src="../../../Users/BirdHouse/Documents/Lotto !/Les logos/Le principe.png" width="550" height="450" alt="Principe de Weezo!" /></p>
</body>
<?php
if(isset($_POST['valider'])){
$id=$_POST['id'];
$passe=$_POST['passe'];
$mail=$_POST['mail'];
mysql_connect('localhost', 'root', '');
mysql_select_db ('teste') ;
mysql_query("INSERT INTO news (id,passe,mail) VALUES ('$id','$passe','$mail')");
}
?>
</html>
<body>
</body>
</html>
--------------------------
--------------------------
LA PAGE CONNEXION [ visu.php ] :
--------------------------
<?php
$_POST['id2'];
$_POST['passe2'];
$db = mysql_connect('localhost', 'root', '');
mysql_select_db('teste');
$sql = 'SELECT id,passe FROM news WHERE id = .id2.';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
echo '<b>'.$data['id'].' '.$data['prenom'].'</b> ';
echo ' <i>date de naissance : '.$data['id'].'</i><br>';
}
mysql_close();
?>
---------------------------
Quand j'exécute , il me dit ceci :
Erreur SQL !
SELECT id,passe FROM news WHERE id = .id2.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
