Sos help code php
sophia
-
Dr Zoidberg Messages postés 529 Date d'inscription Statut Membre Dernière intervention -
Dr Zoidberg Messages postés 529 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai un prob ds mon code qui ne fonctionne po :
<html>
<head><title>gjgj</title></head>
<body>
<center><table>
<tr>
<td>D</td>
<td>H</td>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("rt");
$sql=mysql_query("insert into u value('$abs','$D','$H')");
$r=mysql_fetch_array($sql);
while($r)
{ ?>
<tr>
<td><? $id=$r['D']; ?> </td>
<td><? $id=$r['H']; ?> </td>
<td><a href="modif.php? id<? $r['D']?>">
modif</a>
<a href="sup.php? id<? $r['H'] ?>">
sup</a>
<? }
mysql_close();
?></table></center>
</body>
</html>
j'ai un prob ds mon code qui ne fonctionne po :
<html>
<head><title>gjgj</title></head>
<body>
<center><table>
<tr>
<td>D</td>
<td>H</td>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("rt");
$sql=mysql_query("insert into u value('$abs','$D','$H')");
$r=mysql_fetch_array($sql);
while($r)
{ ?>
<tr>
<td><? $id=$r['D']; ?> </td>
<td><? $id=$r['H']; ?> </td>
<td><a href="modif.php? id<? $r['D']?>">
modif</a>
<a href="sup.php? id<? $r['H'] ?>">
sup</a>
<? }
mysql_close();
?></table></center>
</body>
</html>
A voir également:
- Sos help code php
- Code ascii - Guide
- Code puk bloqué - Guide
- Comment déverrouiller un téléphone quand on a oublié le code - Guide
- Code activation windows 10 - Guide
- Code blocks - Télécharger - Langages
3 réponses
Hello
je viens de survoler ton code, déjà ton HTML n'est pas bon...
Quand tu ouvres ton code PHP tu te trouves toujours à l'intérieur d'une ligne de ton tableau. Puis en PHP tu crées une boucle qui tente de créer des lignes dans cette ligne...
Donc ferme d'abord la ligne avant ton code PHP...
<html>
<head><title>gjgj</title></head>
<body>
<center><table>
<tr>
<td>D</td>
<td>H</td>
</tr>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("rt");
$sql=mysql_query("insert into u value('$abs','$D','$H')");
$r=mysql_fetch_array($sql);
while($r)
{ ?>
<tr>
<td><? $id=$r['D']; ?> </td>
<td><? $id=$r['H']; ?> </td>
<td><a href="modif.php? id<? $r['D']?>">
modif</a>
<a href="sup.php? id<? $r['H'] ?>">
sup</a>
<? }
mysql_close();
?></table></center>
</body>
</html>
je viens de survoler ton code, déjà ton HTML n'est pas bon...
Quand tu ouvres ton code PHP tu te trouves toujours à l'intérieur d'une ligne de ton tableau. Puis en PHP tu crées une boucle qui tente de créer des lignes dans cette ligne...
Donc ferme d'abord la ligne avant ton code PHP...
<html>
<head><title>gjgj</title></head>
<body>
<center><table>
<tr>
<td>D</td>
<td>H</td>
</tr>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("rt");
$sql=mysql_query("insert into u value('$abs','$D','$H')");
$r=mysql_fetch_array($sql);
while($r)
{ ?>
<tr>
<td><? $id=$r['D']; ?> </td>
<td><? $id=$r['H']; ?> </td>
<td><a href="modif.php? id<? $r['D']?>">
modif</a>
<a href="sup.php? id<? $r['H'] ?>">
sup</a>
<? }
mysql_close();
?></table></center>
</body>
</html>
Tu ne dis pas quel est le problème, mais une requete insert ne retourne pas de valeurs sur un tableau ( c'est une insertion, pas un select) :
$sql=mysql_query("insert into u value('$abs','$D','$H')");
$r=mysql_fetch_array($sql);
while($r)
si ton problème est que tu n'a rien dans ton tableau, alors c plustot normal
$sql=mysql_query("insert into u value('$abs','$D','$H')");
$r=mysql_fetch_array($sql);
while($r)
si ton problème est que tu n'a rien dans ton tableau, alors c plustot normal