Jump to content

[SOLVED] msqyl num rows not valid argument.


Foser

Recommended Posts

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\WAMP\www\Projects\LogiPlan\index.php on line 20

 

thats my error.

 

this is my script:

<title>Login Page</title>
<?php 

//starting SESSION
session_start();
//Lazy Login
if ($_SESSION['LOGGEDIN'] == TRUE){
header("Location: /main/index.php");}

//SQL Configuration file
require("config.php");
//when pressed submit execute the FOLOWING
if (isset($_POST['submit'])){
// USER TYPED INFORMATION
$user = mysql_real_escape_string($_POST['username']);
$password = sha1(md5($_POST['password']));

// Searching DB for username and password Match
$result = mysql_query("SELECT * FROM user_info username = '$user' and password = '$password'");
if (mysql_num_rows($result) > 0){

// SETTING UP SESSIONS
$_SESSION['LOGGEDIN'] = TRUE;
$_SESSION['UNAME'] = $user;

//Go To Member Control Panel
if ($_SESSION['LOGGEDIN'] = TRUE){
header("Location: /main/index.php"); exit;
}}

// IF EVERYTHING ELSE IS FALSE EXECUTE THIS:
else {
echo "You have not entered the correct data. You may try again.";}}

?>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<label>Username:
<input type="text" name="username" id="username">
</label>
<br>
Password:
<label>
<input type="password" name="password" id="password">
</label>
<br>
<label>
<input type="submit" name="submit" id="submit" value="submit">
</label>
</form>

 

thansk

Link to comment
Share on other sites

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 '= 'admin' and password = '55c3b5386c486feb662a0785f340938f518d547f'' at line 1

 

wow first time i see this error, seems like it does not know where to get the admin username from. but i checked my database everything is spelled correcly

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.