I am having some problems understanding the php, and mysql communication thing. I have looked at a script off some forum, and coppied it, but I get the error that came from this line: [COLOR=Red]echo (‘error :: could not connect to ‘ . $dbname . ‘ table’);
Any help? Any places out there that is short reading, and can help me with learning the mysql, and php communication thing?
[code=php]<?php
//Login Script
// declare variables
$username=$_POST[‘username’];
$password=$_POST[‘password’];
//
// mysql connection variables
$host = ‘localhost’;
$dbuser = ‘dtoporg_dtop’;
$dbpass = ‘abc123’;
$dbname = ‘dtoporg_login’;
$table = ‘login’;
//
// connect to db
$db = @mysql_connect($host,$dbuser,$dbpass) or die(“error :: could not connect to $host”);
$db = mysql_select_db($dbname);
if(!$db)
{
echo (‘error :: could not connect to ‘ . $dbname . ‘ table’);
exit;
}
//
// check table
$query = mysql_query(“SELECT * FROM $table WHERE USERname = ‘$username’ AND USERpass = ‘$password'”);
$num = mysql_num_rows($query);
if($num>0)
{
echo(‘user :: ok’);
} else {
echo (‘error :: not ok’);
}
?>
Anything that relates to login scripts would be very helpfull, Thanks.