Re: mysql_query(): supplied argument is not a valid MySQL-Link resource
From: aa (aa_at_virgin.net)
Date: 01/15/05
- Next message: Jan Pieter Kunst: "Re: forms with dynamic inputs"
- Previous message: Alvaro G. Vicario: "Re: fopen------ How do I get permission to write to a html file?"
- In reply to: Andy Hassall: "Re: mysql_query(): supplied argument is not a valid MySQL-Link resource"
- Next in thread: aa: "Re: mysql_query(): supplied argument is not a valid MySQL-Link resource"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 15 Jan 2005 11:09:56 -0000
Thanks, Andy, it makes a lot of sense. Even the requirement to expressly
declare a variable as a global one.
However it did not sort my problem out. I played with one variable $db_host:
======================================================
global $chan, $db_host, $username, $password, $DB_name,$DB_name;
$db_host = "humbug";
function write_table()
{
$username = "myusername";
........ $password, $DB_name,$DB_name are assigned values here
$chan = mysql_connect ($db_host, $username, $password);
if ($chan==false)
mysql_error();
.....
}
===================================
produces the same error as before:
Warning: mysql_connect(): Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2) in
/files/home2/andrei/lasershot/pricelist_sql_ansi_split.php on line 42
However if I move
$db_host = "humbug";
inside the function it works fine. Which means that the global variable are
not seen inside a function, or I declare them wrongly
- Next message: Jan Pieter Kunst: "Re: forms with dynamic inputs"
- Previous message: Alvaro G. Vicario: "Re: fopen------ How do I get permission to write to a html file?"
- In reply to: Andy Hassall: "Re: mysql_query(): supplied argument is not a valid MySQL-Link resource"
- Next in thread: aa: "Re: mysql_query(): supplied argument is not a valid MySQL-Link resource"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|