Jump to content

What is wrong here pls


Sorrow

Recommended Posts

The thing i wanna do is if the username is not in the database it needs to print invalid login on the page.


[code]
$result = mysql_query("SELECT * FROM Usagers WHERE Username =  '" .$_POST["Username"]."' AND Password = '".$_POST["Password"]."' " );

$User = $_POST["Username"];
$Pass = $_POST["Password"];

if($Userv== "")

echo "Invalid Login";

else

while($row = mysql_fetch_array($result)) {
echo "
<table border='0' align='center'>
<tr>
<td>Nom Usager : </td>
<td>" . $row['Username'] . "</td>
</tr>
<tr>
<td>Nom :  </td>
<td>" . $row['Nom'] . "</td>
</tr>
<tr>
<td>Prenom :  </td>
<td>" . $row['Prenom'] . "</td>
</tr>
<tr>
<td>Age :  </td>
<td>" . $row['Age'] . "</td>
        </tr>

            <tr>
<td>Sexe :  </td>
<td>" . $row['Sexe'] . "</td>
        </tr>

            <tr>
<td>Adresse :  </td>
<td>" . $row['Adresse'] . "</td>
        </tr>

            <tr>
<td>Ville:  </td>
<td>" . $row['Ville'] . "</td>
        </tr>

            <tr>
<td>Province:  </td>
<td>" . $row['Province'] . "</td>
        </tr>
           
                        <tr>
<td>Pays:  </td>
<td>" . $row['Pays'] . "</td>
        </tr>

           
            <tr>
<td>No. de Tel. :  </td>
<td>" . $row['NoTel'] . "</td>
        </tr>

            <tr>
<td>Taille Physique :  </td>
<td>" . $row['TaillePhysique'] . "</td>
        </tr>

            <tr>
<td>Fumeur :  </td>
<td>" . $row['Fumeur'] . "</td>
        </tr>

            <tr>
<td>Buveur :  </td>
<td>" . $row['Buveur'] . "</td>
        </tr>

            <tr>
<td>Ethnie :  </td>
<td>" . $row['Ethnie'] . "</td>
        </tr>

            <tr>
<td>Courriel :  </td>
<td>" . $row['Courriel'] . "</td>
        </tr>

</table>";


}

?>

[/code]
Link to comment
https://forums.phpfreaks.com/topic/28301-what-is-wrong-here-pls/
Share on other sites

Umm. Where is $Userv come from?
You should count the result to check if the user is in database;
--------------------
$result = mysql_query("SELECT * FROM Usagers WHERE Username =  '" .$_POST["Username"]."' AND Password = '".$_POST["Password"]."' " );
[color=red]$Userv = mysql_num_rows($result);[/color]

$User = $_POST["Username"];
$Pass = $_POST["Password"];

if($Userv== [color=red]0[/color])

echo "Invalid Login";
...
..
.
--------------------

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.