Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-08-2005, 06:52 PM Member login help
KML9870's Avatar
One Bad Mamma :-)

Posts: 5,489
Name: Kandi
Location: Western NY
Trades: 0
Okay, from everything I have read this code should check the username & password against my table, but for some reason it's going to the next page without regardless of the user input

Please help!!
Code:
<?php

include("misc.inc");

  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");
session_id()


$Username= 'Username';
$Password= 'Password';

$query = "SELECT * FROM Recruiter
	WHERE 'Username'='$Username' AND 'Password'='$Password'";

	$results = mysql_query or die('error making query');

 IF ($results = 1)

    { header("Location:Recruiters.php");
}
	ELSE
     header("Location:LoginForm.php");





?>
THANK YOU!!!
KML9870 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-08-2005, 08:21 PM
.Mike's Avatar
Novice Talker

Posts: 9
Location: Savannah, GA
Trades: 0
I didn't look at all of your code, but one error I spotted right away was this:

IF ($results = 1)

It basically says, "If I am able to assign the value 1 to the variable $results..."

Try:

IF ($results == 1)

...for checking if $results equals 1.

Mike
.Mike is offline
Reply With Quote
View Public Profile Visit .Mike's homepage!
 
Old 06-08-2005, 08:34 PM
KML9870's Avatar
One Bad Mamma :-)

Posts: 5,489
Name: Kandi
Location: Western NY
Trades: 0
Thanks Mike, I changed that, but it still isn't checking it.
KML9870 is offline
Reply With Quote
View Public Profile
 
Old 06-08-2005, 09:48 PM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
Quote:
$query = "SELECT * FROM Recruiter
WHERE 'Username'='$Username' AND 'Password'='$Password'";

$results = mysql_query or die('error making query');

IF ($results = 1)

{ header("Location:Recruiters.php");
}
ELSE
header("Location:LoginForm.php");
okay try this instead

PHP Code:
$sql mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
$login_check mysql_num_rows($sql);

if(
$login_check 0){
    while(
$row mysql_fetch_array($sql)){
        
/*  session_start();
      //  use edit the following if you want sessions 
       $_SESSION['first_name'] = $row['fname'];
       $_SESSION['last_name'] = $row['lname'];
       $_SESSION['email_address'] = $row['email'];
       $_SESSION['access'] = $row['access'];
       $_SESSION['username'] = $row['username'];
       $session = session_id();
        */
        
header("Location: Recruiters.php"); 
I based it off of my working logon script
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Old 06-09-2005, 08:10 PM
Monkeon's Avatar
Skilled Talker

Posts: 59
Trades: 0
KML9870, I don't know if I'm right in saying this, but it looks like your section of code

PHP Code:
$results mysql_query or die('error making query'); 
is causing the problem

$results = mysql_query($query) or die('error making query');


but that is not all...I think you need to use mysql_num_rows to assign the numeric value to your variable.

$rownumber = mysql_num_rows($query);

now you can check whether $rownumber == 1
Monkeon is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 08:15 PM oops now I made a mistake!
Monkeon's Avatar
Skilled Talker

Posts: 59
Trades: 0
oops I made a small error

change

$rownumber = mysql_num_rows($query);

to

$rownumber = mysql_num_rows($results);
Monkeon is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Member login help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25110 seconds with 12 queries