PROBLEME: mysql_free_result

lucio -  
 lucio -
Bonjour,

Je suis extrêmement débutant et j'ai un soucis avec mon code pour faire ma page "login" de mon site. Quand je vais sur cette page "login" dans l'explorer voila ce qui s'affiche:



if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colpass_rsLogin = "0"; if (isset($HTTP_POST_VARS['pass'])) { $colpass_rsLogin = $HTTP_POST_VARS['pass']; } $colname_rsLogin = "0"; if (isset($HTTP_POST_VARS['email'])) { $colname_rsLogin = $HTTP_POST_VARS['email']; } mysql_select_db($database_rsLogin, $rsLogin); $query_rsLogin = sprintf("SELECT clients.email, clients.pass, clients.nom, clients.statut, clients.ID FROM clients WHERE clients.email=%s AND clients.pass=%s", GetSQLValueString($colname_rsLogin, "int"),GetSQLValueString($colpass_rsLogin, "int")); $rsLogin = mysql_query($query_rsLogin, $rsLogin) or die(mysql_error()); $row_rsLogin = mysql_fetch_assoc($rsLogin); $totalRows_rsLogin = mysql_num_rows($rsLogin); ?> Identification membres
Votre email :
Votre mot de passe :


Pour vous inscrire, cliquez ici




Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in D:\www\izimo.eu\htdocs\login.php on line 121

1 réponse

lucio
 
Re-bonjour, juste pour info voici mon code pour cette page 'login' (j'ai juste remplacé mes données de connection mysql par XXXXXX ne vous inquiétez pas c'est normal!) Merci à tous par avance!




<?php
// connexion à votre base de données
$pwd = "XXXXXXXXXX";
$mysql_link=mysql_connect("XXXXXXXXXX", "izimo109416", "XXXXXXXXXX");
mysql_select_db("izimo109416", $mysql_link);
?>
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colpass_rsLogin = "0";
if (isset($HTTP_POST_VARS['pass'])) {
$colpass_rsLogin = $HTTP_POST_VARS['pass'];
}
$colname_rsLogin = "0";
if (isset($HTTP_POST_VARS['email'])) {
$colname_rsLogin = $HTTP_POST_VARS['email'];
}
mysql_select_db($database_rsLogin, $rsLogin);
$query_rsLogin = sprintf("SELECT clients.email, clients.pass, clients.nom, clients.statut, clients.ID FROM clients WHERE clients.email=%s AND clients.pass=%s", GetSQLValueString($colname_rsLogin, "int"),GetSQLValueString($colpass_rsLogin, "int"));
$rsLogin = mysql_query($query_rsLogin, $rsLogin) or die(mysql_error());
$row_rsLogin = mysql_fetch_assoc($rsLogin);
$totalRows_rsLogin = mysql_num_rows($rsLogin);
?>
<?php
if ($HTTP_POST_VARS['valider']=="ok")
{
session_start();
$statut=$row_rsLogin['statut'];
$clientID=$row_rsLogin['ID'];
$clientNom=$row_rsLogin ['nom'];
if ($row_rsLogin['statut']=="client")
{
session_register("statut");
session_register("clientID");
session_register("clientNom");
header("Location:menu.php");
}
else
{
$erreurlog=1;
}
}
?>
<!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>Untitled Document</title>
</head>

<body>
<table width="500" border="1">
<tr>
<td colspan="2">Identification membres</td>
</tr>
<tr>
<td width="245">Votre email : </td>
<td width="239"><form id="form1" name="form1" method="post" action="login.php">
<input type="text" name="email" id="email" />
</form></td>
</tr>
<tr>
<td>Votre mot de passe : </td>
<td><form id="form2" name="form2" method="post" action="login.php">
<input type="text" name="pass" id="pass" />
</form></td>
</tr>
<tr>
<td> </td>
<td><form id="form4" name="form4" method="post" action="login.php">
<input name="valider" type="hidden" id="textfield" value="OK" />
</form></td>
</tr>
<tr>
<td> </td>
<td><form id="form3" name="form3" method="post" action="login.php">
<input name="button" type="submit" id="button" value="Valider" />
</form></td>
</tr>
<tr>
<td colspan="2">Pour vous inscrire, <a href="inscription.php">cliquez ici</a></td>
</tr>
</table>
<p> </p>
<?php
if ($erreurlog==1)
{
?>
<p><strong>Le mot de passe ou votre login est erroné<br />
si le problème persiste contactez le webmaster, merci<br />
</strong></p>
<?php
}
?>
</body>
</html>
<?php
mysql_free_result($rsLogin);
?>
0