Page 1 of 1

mysql querry error

Posted: Wed Jun 01, 2005 9:33 pm
by method_man
for some reason when i connect i get this error

Connected successfully
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/www/twarowsk.freeownhost.com/StreetLife/process.php on line 7

Warning: mysql_query(): A link to the server could not be established in /home/www/twarowsk.freeownhost.com/StreetLife/process.php on line 7

this is my code:

Code: Select all

<?PHP

require('dblink.php');

//mysql query
$query = 'INSERT INTO member (username, password, email address) VALUES ("'.$_POST[loginName].'", "'.$_POST[password].'", "'.$_POST[email].'")';
$db_query = mysql_query($query);
$to = $_POST['Email'];//the email address the user submitted
$subject = 'You Registered!';
$message = 'You have just registered to play on The Streets. To log in go to the main page and use your username and password to sign in.';//the body of the email you are sending

mail($to, $subject, $message);//mail sent

?>
and this is dblink.php:

Code: Select all

<?php
$link = mysql_connect('127.0.0.1', 'twarowsk_newdata@freeownhost.com', '********');
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
thanks,

matt

Posted: Wed Jun 01, 2005 10:03 pm
by hawleyjr
Connected successfully???
Connected successfully
Warning: mysql_query(): Can't connect to local MySQL server through socket
Mods please remove username from this person's connection string....

A couple notes. Try replacing the IP address with the sting "localhost"

Also put the die() after the mysql_connect();

Posted: Wed Jun 01, 2005 10:05 pm
by wyred
Take a close look at line 7 of your dblink.php.

Posted: Wed Jun 01, 2005 10:09 pm
by hawleyjr
wyred wrote:Take a close look at line 7 of your dblink.php.
Holy Cats! I missed that....lol

Posted: Wed Jun 01, 2005 10:18 pm
by method_man
i still cant figure out what the problem is

Re: mysql querry error

Posted: Wed Jun 01, 2005 10:43 pm
by hawleyjr
method_man wrote:
and this is dblink.php:

Code: Select all

<?php
$link = mysql_connect('127.0.0.1', 'twarowsk_newdata@freeownhost.com', '********');
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
Remove:

Code: Select all

mysql_close($link);