Problème PHP (création d’un forum)
cyberboytn
-
cyberboytn -
cyberboytn -
Bonjour,
<html>
<?php
$code=$_GET['code'];
include('connect.php');
mysql_connect($dbhost,$login,$pass);
mysql_select_db($bdd);
$r=mysql_query("SELECT * FROM forumk where code=$code");
$kes=mysql_result($r,0,"question");
$dis=mysql_result($r,0,"nom");
mysql_close();
?>
<head>
<meta http-equiv="Content-Language" content="fr">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Nouvelle question</title>
</head>
<body bgcolor="#00CCFF">
<center>
<table border="0" cellspacing="0" width="899" height="49"bgcolor="#0066FF">
<tr>
<td width="895" height="49">
<p align="center"><font face="Comic Sans MS" size="6" color="#FFFFFF"><img src="isig.jpg" align="left" height="80" width="250">Forum
d'etudiant</font></td>
</tr>
</table>
</center>
<br><br><br>
<?
mysql_connect($dbhost,$login,$pass);
mysql_select_db($bdd);
$resulta=mysql_query("SELECT * from forumr,forumk where forumk.code=forumr.id AND forumr.id=$code ");
$nbligne=mysql_num_rows($resulta); //ligne erroner
$j=0;
?>
<center><p><font face="Forte" size="5">Réponses à la question: <? echo "$kes"; ?> </font></p></center>
<?
while($j<$nbligne)
{$reponse= mysql_result($resulta,$j,"reponse");
$reponse=htmlspecialchars($reponse,ENT_QUOTES);
$reponse=nl2br($reponse);
$repondeur= mysql_result($resulta,$j,"nomr");
?>
<table border="1" cellspacing="0" width="100%" bordercolor="#99CCFF" height="102">
<tr>
<td width="22%" ><font face="Georgia"><i>Par </i><b><? echo "$repondeur"; ?></b></font></td>
<td width="78%" ><font face="Georgia"><? echo "$reponse"; ?></font></td>
</tr>
</table>
<br>
<?$j++;
}?>
<?
mysql_close();
?>
<body bgcolor="#E6F2FF">
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><b><i><font size="5"> Ajouter votre reponse à <? echo "$dis"; ?>:</font></i></b></p>
<p align="center"> </p>
<form method='post' action='ajour.php?cod=<? echo "$code" ?>'>
<table border="0" cellspacing="0" width="100%" height="88">
<tr>
<td width="41%" height="25">
Nom:</td>
<td width="59%" height="25"><input type='text' name="nomre" value=""></td>
</tr>
<tr>
<td width="41%" height="59">
Réponse:</td>
<td width="59%" height="59"><textarea name="reponse" cols=30 rows=3></textarea></td>
</tr>
</table>
<p align="center"> <input type='submit' name="envoi" value="Envoyer"></p>
</form>
<br><center><a href="indx.php"><font size="5">Retour</font></a>
</center>
<br><center><font size="3"> © cyberboytn 2008 </font></center>
</body>
</html>
<html>
<?php
$code=$_GET['code'];
include('connect.php');
mysql_connect($dbhost,$login,$pass);
mysql_select_db($bdd);
$r=mysql_query("SELECT * FROM forumk where code=$code");
$kes=mysql_result($r,0,"question");
$dis=mysql_result($r,0,"nom");
mysql_close();
?>
<head>
<meta http-equiv="Content-Language" content="fr">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Nouvelle question</title>
</head>
<body bgcolor="#00CCFF">
<center>
<table border="0" cellspacing="0" width="899" height="49"bgcolor="#0066FF">
<tr>
<td width="895" height="49">
<p align="center"><font face="Comic Sans MS" size="6" color="#FFFFFF"><img src="isig.jpg" align="left" height="80" width="250">Forum
d'etudiant</font></td>
</tr>
</table>
</center>
<br><br><br>
<?
mysql_connect($dbhost,$login,$pass);
mysql_select_db($bdd);
$resulta=mysql_query("SELECT * from forumr,forumk where forumk.code=forumr.id AND forumr.id=$code ");
$nbligne=mysql_num_rows($resulta); //ligne erroner
$j=0;
?>
<center><p><font face="Forte" size="5">Réponses à la question: <? echo "$kes"; ?> </font></p></center>
<?
while($j<$nbligne)
{$reponse= mysql_result($resulta,$j,"reponse");
$reponse=htmlspecialchars($reponse,ENT_QUOTES);
$reponse=nl2br($reponse);
$repondeur= mysql_result($resulta,$j,"nomr");
?>
<table border="1" cellspacing="0" width="100%" bordercolor="#99CCFF" height="102">
<tr>
<td width="22%" ><font face="Georgia"><i>Par </i><b><? echo "$repondeur"; ?></b></font></td>
<td width="78%" ><font face="Georgia"><? echo "$reponse"; ?></font></td>
</tr>
</table>
<br>
<?$j++;
}?>
<?
mysql_close();
?>
<body bgcolor="#E6F2FF">
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><b><i><font size="5"> Ajouter votre reponse à <? echo "$dis"; ?>:</font></i></b></p>
<p align="center"> </p>
<form method='post' action='ajour.php?cod=<? echo "$code" ?>'>
<table border="0" cellspacing="0" width="100%" height="88">
<tr>
<td width="41%" height="25">
Nom:</td>
<td width="59%" height="25"><input type='text' name="nomre" value=""></td>
</tr>
<tr>
<td width="41%" height="59">
Réponse:</td>
<td width="59%" height="59"><textarea name="reponse" cols=30 rows=3></textarea></td>
</tr>
</table>
<p align="center"> <input type='submit' name="envoi" value="Envoyer"></p>
</form>
<br><center><a href="indx.php"><font size="5">Retour</font></a>
</center>
<br><center><font size="3"> © cyberboytn 2008 </font></center>
</body>
</html>
A voir également:
- Problème PHP (création d’un forum)
- Creation compte gmail - Guide
- Création site web - Guide
- Création d'un compte google - Guide
- Media creation tool - Télécharger - Systèmes d'exploitation
- Abonnement iptv illegaal forum - Forum TV & Vidéo
7 réponses
cyberboytn
mais un peut compliquer a ecrire.........
kilian
Messages postés
8854
Statut
Modérateur
1 526
Mais j'ai surtout aimé le moment ou tu as fait ton mysql_connect()! A partir de là on commençait à voir poindre un style subtil et en même temps très détaché.
je ponse que le problem c'est ici
<?
mysql_connect($dbhost,$login,$pass);
mysql_select_db($bdd);
$resulta=mysql_query("SELECT * from forumr,forumk where forumk.code=forumr.id AND forumr.id=$code ");
$nbligne=mysql_num_rows($resulta); //ligne erroner
$j=0;
?>
<?
mysql_connect($dbhost,$login,$pass);
mysql_select_db($bdd);
$resulta=mysql_query("SELECT * from forumr,forumk where forumk.code=forumr.id AND forumr.id=$code ");
$nbligne=mysql_num_rows($resulta); //ligne erroner
$j=0;
?>
Je sait pas exactement mai il m'affiche l’errer suivant
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in Racine:\emplacement\repon.php on line 36
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in Racine:\emplacement\repon.php on line 36
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Il doit y avoir un soucis avec ta requête.
Met ceci dans ton code:
echo "SELECT * from forumr,forumk where forumk.code=forumr.id AND forumr.id=$code ";
Et essaie d'executer ce qu'il va t'afficher en utilisant PhpMyAdmin.
Met ceci dans ton code:
echo "SELECT * from forumr,forumk where forumk.code=forumr.id AND forumr.id=$code ";
Et essaie d'executer ce qu'il va t'afficher en utilisant PhpMyAdmin.
il m'affiche le message suivant
Base de données bdd - Table forumr sur le serveur localhost
Erreur
requête SQL :
SELECT *
FROM forumr, forumk
WHERE forumk.code = forumr.id AND forumr.id = $code
LIMIT 0 , 30
MySQL a répondu:
#1054 - Champ 'forumr.id' inconnu dans where clause
Base de données bdd - Table forumr sur le serveur localhost
Erreur
requête SQL :
SELECT *
FROM forumr, forumk
WHERE forumk.code = forumr.id AND forumr.id = $code
LIMIT 0 , 30
MySQL a répondu:
#1054 - Champ 'forumr.id' inconnu dans where clause