View Full Version : error

03-24-2007, 03:32 AM
Any idea what it is

mysql_query(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)

i am calling a function in another page using include at the top of the page to get a connection to the database
Could this have anything to do with the problem



function AddItem($itemId, $qty)

$result = mysql_query("select count(*) from cart where cookieId = '" . GetCartId() . "' and itemId = $itemId");

$row = mysql_fetch_row($result);
$numRows = $row[0];

if($numRows == 0)
mysql_query("insert into cart(cookieId, itemId, qty) values('" . GetCartId() . "', $itemId, $qty)");
UpdateItem($itemId, $qty);

The page i am calling uses this code


$pass="pass"; //these are set to the correct values

function ConnectToDb($server, $user, $pass, $database)
$s = mysql_connect($server, $user, $pass);
$d = mysql_select_db($database, $s);

if(!$s || !$d)
return false;
return true;


03-24-2007, 03:38 AM
You've included the code for the function but you aren't calling the function anywhere. You just need to add

ConnectToDb($server, $user, $pass, $database);

after the include, or put that inside the include-- however you want to do it.

03-24-2007, 03:47 AM
im really silly

03-24-2007, 02:08 PM
Bunny, I've told you before. Use a subject title that describes what your problem is.

03-24-2007, 06:57 PM
if you didn't give him an infraction...then i am going to get mad. i recieved a infraction once for "some minor css trouble"...and he has "error". that is like 2x worse >_>.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum