Jump to content

[SOLVED] Warning: mysql_close(): supplied argument......


plutomed

Recommended Posts

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/plutomed/public_html/new/functions.php on line 20

 

Here is my function that connects:

 

function connect_db($user, $pass, $db)
{
$con = mysql_connect("localhost", $user, $pass) or die(mysql_error());
$db_selected = mysql_select_db($db) or die(mysql_error());
}

 

And the query function:

 

function referer()
{
connect_db("uname", "pass", "db");

//query

mysql_close($con);
}

is it because you have $con in a different function and it isnt carried over to the other function unless you set it to a gobal.

 

this is just a guess seeing as I don't like functions so I don't use them ;D

 

~ Chocopi

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.