|
|
|
| Подскажите пожалуйста в чем ошибка ?
class KW_Connect{
var $host = "localhost";
var $user = "";
var $password = "";
var $resource_kw;
var $resource_ring;
function KW_Connect(){
$this->connect();
}
function connect(){
$this->resource_kw = mysql_connect("$this->host","$this->user","$this->password") or die("Не могу соединится с SQL-server");
mysql_select_db("kw", $this->resource_kw);
mysql_query("SET NAMES cp1251", $this->resource_kw);
$this->resource_ring = mysql_connect("$this->host","$this->user","$this->password") or die("Не могу соединится с SQL-server");
mysql_select_db("ring", $this->resource_ring, true);
mysql_query("SET NAMES cp1251", $this->resource_ring);
}
function mysql_kw($sql){
$result = MYSQL_QUERY($sql,$this->resource_kw);
return $result;
}
function mysql_ring($sql){
$result = MYSQL_QUERY($sql,$this->resource_ring);
return $result;
}
}
|
ругается на [Thu Apr 03 10:46:27 2008] [error] PHP Warning: Wrong parameter count for mysql_select_db() in /home/html/classes/sid.class.php on line 19
mysql_select_db("ring", $this->resource_ring, true);
|
это из документации:
If you are trying to open multiple, separate MySQL connections with the same MySQL user, password, and hostname, you must set $new_link = TRUE to prevent mysql_connect from using an existing connection.
For example, you are opening two separate connections to two different databases (but on the same host, and with the same user and password):
$db1 = mysql_connect($dbhost, $dbuser, $dbpass);
$rv = mysql_select_db($dbname1, $db1);
$db2 = mysql_connect($dbhost, $dbuser, $dbpass);
$rv = mysql_select_db($dbname2, $db2);
At this point, both $db1 and $db2 will have selected the database named by $dbname2.
The workaround is to require that the second MySQL connection is new:
$db1 = mysql_connect($dbhost, $dbuser, $dbpass);
$rv = mysql_select_db($dbname1, $db1);
$db2 = mysql_connect($dbhost, $dbuser, $dbpass, TRUE);
$rv = mysql_select_db($dbname2, $db2);
Now, $db1 should have selected $dbname1, and $db2 should have selected $dbname2.
This has been documented on the mysql_select_db page as well.
Note: This occurs only when the server, username, and password parameters are identical for each mysql_connect statement
|
ПОдскажите пожалуйста где у меня ошибка ? почему я не могу работать одновременно с 2 базами.. :( | |
|
|
|
|
|
|
|
для: sidPR
(03.04.2008 в 10:41)
| | и без true пробывал .. в коде ошибка в mysql_connect добавляется true после пароля ..
но как я только не пробывал все безполезно :( | |
|
|
|
|
|
|
|
для: sidPR
(03.04.2008 в 10:41)
| | Дело в том, что у функции mysql_select_db() в PHP всегда было два параметра - в примере из документации тоже два параметра. У вас зачем-то передаётся третий параметр true. | |
|
|
|
|
|
|
|
для: cheops
(03.04.2008 в 11:42)
| | без него тоже не работает
, есть вероятность того что если я пользуюсь одним и темже пользователем и паролем и из за этого не работает | |
|
|
|