Hi,
I am writing a login page but the php code to authenticate user is not working.
My login web page calls 'action="xLogin Check.php"'. Below is the php code. I am writing to a log file to trace program flow.
I know it is ok up to the "hoho" bit. This code(version1) works.
This code(version2) doesn't work, ie when I add the mysql_connect bit. Nothing inside the mysql_connect {} appear on the screen or the log file. I just get error page that says "website cannot display page"
Can anyone see where the problem is?? What is the best way to trace php code???
thanks
I am writing a login page but the php code to authenticate user is not working.
My login web page calls 'action="xLogin Check.php"'. Below is the php code. I am writing to a log file to trace program flow.
I know it is ok up to the "hoho" bit. This code(version1) works.
Code:
<?php
$host="localhost"; // Host name
$username="****"; // Mysql username
$password="****"; // Mysql password
$db_name="accounts"; // Database name
$tbl_name="userstbl"; // Table name
$FileName = "log.txt";
$FileHandle = fopen($FileName,'w') or die("can't open file");
fwrite($FileHandle, "hoho\n");
fclose($FileHandle);
?>
Code:
<?php
$host="localhost"; // Host name
$username="****"; // Mysql username
$password="****"; // Mysql password
$db_name="accounts"; // Database name
$tbl_name="userstbl"; // Table name
$FileName = "log.txt";
$FileHandle = fopen($FileName,'w') or die("can't open file");
fwrite($FileHandle, "hoho\n");
if (!$connection = mysql_connect($host, $username, $password))
{
$message = mysql_error();
fwrite($FileHandle, $message);
fclose($FileHandle);
die();
}
?>
thanks
Comment