Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
Thread Tools Display Modes
Old 09-10-2010, 12:01 PM   #1
Join Date: Sep 2010
Posts: 1
Default Login Help

I'm completing the video tutorial for the php log in script and I'm having trouble getting it to work. It keeps returning that my user/password are wrong even though I have checked these. can anyone help?

PHP Code:

$database "db";
$username "user";
$password "password";

// Choose Connection
$link = @mysql_connect($database ,$username$password);
$db   =mysql_select_db($database$link);

//catch 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);

$rowAccount) {

<!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 name="form1"  id="form1" method="post" action="<?php $_SERVER['PHP_SELF'];?>">
<table width="259" height="272" border="1" align="center">
    <td width="82" height="45">Username</td>
    <td width="161" ><input name="userid" type="text" id="userid" /></td>
    <td width="82" height="45">Password</td>
      <input name="password" type="text"  id="password" />
     <input name="Submit" type="submit" value="Submit"/>
      <input name="submitted" type="hidden" id="submitted" value="1" />
chris_burns7186 is offline  
Old 09-13-2010, 05:18 PM   #2
davidj's Avatar
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256

check your database table field naming conventions
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk

Last edited by davidj; 09-13-2010 at 05:22 PM..
davidj is offline  
Old 10-23-2013, 07:17 PM   #3
Join Date: Oct 2013
Location: Poland
Posts: 51

user and user_name aren't the same
krzy is offline  
Old 11-02-2017, 07:28 AM   #4
Join Date: Dec 2016
Posts: 1

artikel bagus
global2017 is offline  
Old 11-03-2017, 01:35 AM   #5
edbr's Avatar
Join Date: Aug 2005
Location: Bali
Posts: 11,218

Tidak Bagus. No not good. 7 year old post and mysql is depreciated so pretty useless now
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline  
Closed Thread

Thread Tools
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

Forum Jump

All times are GMT. The time now is 01:07 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.