Re: database
| From: | Jordan S. Jones | Date: | Mon, 27 Oct 2003 21:27:39 +0000 |
| Subject: | Re: database | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167792@lists.php.net to get a copy of this message | ||
Alain,
Ok, I aplogize, for I neglected to notice that you were not passing back the db connection $link variable from your openDB function, so here is what you are going to want to do.
page connectie.php
Function openDB()
{
$link = mysql_connect("localhost", "host", "pas")
or die("geen connectie mogelijk : " . mysql_error());
print "connectie ok";
mysql_select_db("database") or die("geen database gevonden");
return $link;
}
Function closeDB($ref_link)
{
mysql_close($ref_link);} include ('connectie.php'); //open connectie
$connectie = openDB();
//code//close connectie closeDB($connectie); Jordan S. Jones alain dhaene wrote:
I have try but I get the following error: Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/schoolre/public_html/Hitek/Online/connectie.php on line 16 Alain "Jordan S. Jones" <list@racistnames.com> schreef in bericht news:3F9D61F5.7040105@racistnames.com...-- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.com&item_name=Jordan+S.+Jones&no_note=1&tax=0¤cy_code=USDAlain, You can pass it in the function as a variable. E.g... Function closeDB($ref_link) {https://www.paypal.com/xclick/business=list%40racistnames.com&item_name=Jord an+S.+Jones&no_note=1&tax=0¤cy_code=USDmysql_close($ref_link);} closeDB($connectie); Hope this Helps, Jordan S. Jones -- I am nothing but a poor boy. Please Donate..