View Full Version : login script doesn't recognise i'm entering valid data, just tells me that it doesnt exist.

10-26-2010, 08:06 PM
I'm using David Jackson login script tutorials and i'm just on part 1,

I'm at the stage where I'm testing the script in my browser but when I input my user and password, it says that it does not exist. even if I enter what is supposed to be invalid data, it says it doesnt exist, which is what I want but if it's correct, I want it to tell me it's good.

here is my php code.
require_once("Connections/dbconfig.php"); //database connection

//path field data

$userid = $_POST['userid'];
$password = $_POST['password'];
$submitted = $_POST['submitted'];

if ($userid && $password) {

$query = sprintf("SELECT * FROM users where user_name='$userid' and user_password = '$password'");
$result = @mysql_query($query);
$rowAccount = @mysql_fetch_array($result);

if ($rowAccount){

echo "The record exists so you can enter ";


echo "You don't exist in the system so you're not getting in !";


and this is the HTML code,

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

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

<table width="400" border="1">
<td width="177" height="38">User ID</td>
<td width="207"><label>
<input type="text" name="userid" id="userid" />
<td height="48">Password</td>
<input type="text" name="password" id="password" />
<td height="66">&nbsp;</td>
<input type="submit" name="submitted" id="submitted" value="Submit" />

any help as to why this isn't working would be appreciated.



10-26-2010, 09:15 PM
I deleted the data fields in my table and tried to input my details again, and regardless of whether the data is correct or incorrect, it still says it doesn't exist.

could this be something to do with the way it is linked or something,

my database tab in dreamweaver recognises that my user table is there, and so it must be something that the data isn't getting read.

10-27-2010, 06:01 PM

contact me through the enquiry form on http://codezenith.co.uk (http://codezenith.co.uk)

I will help you sort this