Go Back   Computer Forums > Web Design | Website Development > Web Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 04-27-2008, 11:58 AM   #1
Baseband Member
Join Date: Nov 2007
Posts: 33
Question Whats wrong with this code??

I watched a video tutorial but it was a bit hard to see...
Soo what do i need to change in order for this to work?

PHP Code:

$db mysql_select_db(prefix_dbname$connection);

$sql "SELECT id FROM user
            WHERE username= ' 
            AND password= ' 
$_POST(password)' ";
$result mysql_query($sql);
$num mysql_num_rows($result);

if (
$num 0| )

$id mysql_fetch_assoc($result);

setcookie ("auth""yes"time () +6000);
setcookie ("id"$id'id' ] );
setcookie ("username"$id'Username' ] );

header ("Location: main.php");

}else {

header ("Location: incorrect.php");

And how would i set up my databases with this code? [The names of them]
[And yes i have the login forum on another html page]
<title>Login Form</title>

<form name=login action=login.php method=post>

Username: <input type=text name=username>
Password: <input type=text name=username>
<input type=submit value='Login'>

Please help (DAA)

DoubleAA is offline   Reply With Quote
Old 04-27-2008, 04:36 PM   #2
Site Team
David Lindon's Avatar
Join Date: Dec 2002
Posts: 15,233
Default Re: Whats wrong with this code??

first you need to change this:

localhost, prefix_user, password
To something like
localhost, root, password

Then you need to create a table called 'users', with the columns - 'id','username','password'
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 07:23 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0