Jump to content

Recommended Posts

I cant fix this... please help....

 

I get error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tritusco/public_html/includes/checklogin.php on line 29

Wrong Username or Password

 

 

<?php

//session_start();

ob_start();

$host="localhost"; // Host name

$username="****"; // Mysql username

$pass="*****"; // Mysql password

$db_name="tritusco_members"; // Database name

$tbl_name="user_register"; // Table name

 

// Connect to server and select databse.

mysql_connect("$host", "$username", "$pass")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");

 

 

// username and password sent from form

$email=$_POST['email'];

$pass=$_POST['pass'];

 

// To protect MySQL injection (more detail about MySQL injection)

$email = stripslashes($email);

$pass = stripslashes($pass);

$email = mysql_real_escape_string($email);

$pass = mysql_real_escape_string($pass);

 

$sql="SELECT * FROM $tbl_name WHERE username='$email' and password='$pass'";

$result=mysql_query($sql);

 

// Mysql_num_row is counting table row

$count = mysql_num_rows($result); // LINE 29

// If result matched $email and $pass, table row must be 1 row

 

if($count==0){

// Register $email, $pass and redirect to file "login_success.php"

echo "Wrong Username or Password";}

else {

session_register("email");

session_register("pass");

header("location:login_success.php");

 

}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/154109-help-needed/
Share on other sites

heh yea i looked in the database, and no the passwords are not encrypted.... Im trying to make it check email and password from database and login... go try register and login.... and dont criticize me plz im noob with php and its a day old site :-X hah  www.tritusco.com

 

 

if u got aim maybe u could aim me? Atticus504

Link to comment
https://forums.phpfreaks.com/topic/154109-help-needed/#findComment-810118
Share on other sites

it's not returning any results, so check and make sure all your data is correct .. make sure the username and password in the db are exactly as you are typing them.

 

and you'd better lose the session_register() as it's set to be removed come the newest version of PHP.

Link to comment
https://forums.phpfreaks.com/topic/154109-help-needed/#findComment-810126
Share on other sites

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tritusco/public_html/includes/checklogin.php on line 29

 

This usually means that the query is failing.  What exactly does it say when you put the or die statement at the end of the query call?

Link to comment
https://forums.phpfreaks.com/topic/154109-help-needed/#findComment-810131
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.