Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
how can i resolve this:

Warning: mysql_connect() [function.mysql-connect]: Lost connection to
MySQL server during query in /home/fhlinux169/c/
htdocs/checklogin.php on line 9
cannot connect

this is the script. please help.very stuck

$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from signup form

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and

// Mysql_num_row is counting table row
// If result matched $myusername and $mypassword, table row must be 1

// Register $myusername, $mypassword and redirect to file
else {
echo "Wrong Username or Password";

Re: stuck

Quoted text here. Click to load it

I can't really see anything obviously wrong...although I like to
specify my link handles ie. $db = mysqlconnect() and specify $db

run mysqladmin...what is the connect_timeout set to?

Re: stuck

Give username as root and password as null and then check

Re: stuck wrote:
Quoted text here. Click to load it

Not his problem - he's connecting just fine.

And username of root with no password is about as insecure as you can get.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: stuck

Quoted text here. Click to load it

Does your user have privileges in MySQL to do the operation on line 9
of your code (SELECT database?)  I believe you get disconnected if you
are not authorized to execute a query.

Site Timeline