how can i resolve this:
Warning: mysql_connect() [function.mysql-connect]: Lost connection to
MySQL server during query in /home/fhlinux169/c/clashoff.co.uk/user/
htdocs/checklogin.php on line 9
cannot connect
this is the script. please help.very stuck
<?php
$host="localhos t"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test" ; // Database name
$tbl_name="memb ers"; // Table name
// Connect to server and select databse.
mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");
mysql_select_db ("$db_name") or die("cannot select DB");
// username and password sent from signup form
$myusername=$_P OST['myusername'];
$mypassword=$_P OST['mypassword'];
$sql="SELECT * FROM $tbl_name WHERE username='$myus ername' and
password='$mypa ssword'";
$result=mysql_q uery($sql);
// Mysql_num_row is counting table row
$count=mysql_nu m_rows($result) ;
// If result matched $myusername and $mypassword, table row must be 1
row
if($count==1){
// Register $myusername, $mypassword and redirect to file
"login_success. php"
session_registe r("myusername") ;
session_registe r("mypassword") ;
header("locatio n:login_success .php");
}
else {
echo "Wrong Username or Password";
}
?>
Warning: mysql_connect() [function.mysql-connect]: Lost connection to
MySQL server during query in /home/fhlinux169/c/clashoff.co.uk/user/
htdocs/checklogin.php on line 9
cannot connect
this is the script. please help.very stuck
<?php
$host="localhos t"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test" ; // Database name
$tbl_name="memb ers"; // Table name
// Connect to server and select databse.
mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");
mysql_select_db ("$db_name") or die("cannot select DB");
// username and password sent from signup form
$myusername=$_P OST['myusername'];
$mypassword=$_P OST['mypassword'];
$sql="SELECT * FROM $tbl_name WHERE username='$myus ername' and
password='$mypa ssword'";
$result=mysql_q uery($sql);
// Mysql_num_row is counting table row
$count=mysql_nu m_rows($result) ;
// If result matched $myusername and $mypassword, table row must be 1
row
if($count==1){
// Register $myusername, $mypassword and redirect to file
"login_success. php"
session_registe r("myusername") ;
session_registe r("mypassword") ;
header("locatio n:login_success .php");
}
else {
echo "Wrong Username or Password";
}
?>
Comment