Warning: mysql_select_db() expects parameter 2 to be resource, object given in C:\Users\SH170\Desktop\wamp\www\tabprod\configuration.php on line 10
Warning: mysql_select_db() expects parameter 2 to be resource, object given in C:\Users\SH170\Desktop\wamp\www\tabprod\configuration.php on line 21
object(mysqli)#1 (17) { ["affected_rows"]=> int(0) ["client_info"]=> string(50) "mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $" ["client_version"]=> int(50005) ["connect_errno"]=> int(0) ["connect_error"]=> string(0) "" ["errno"]=> int(0) ["error"]=> string(0) "" ["field_count"]=> int(0) ["host_info"]=> string(37) "MySQL host info: localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(20) "5.1.36-community-log" ["server_version"]=> int(50136) ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(9) ["warning_count"]=> int(0) } object(mysqli)#2 (17) { ["affected_rows"]=> int(0) ["client_info"]=> string(50) "mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $" ["client_version"]=> int(50005) ["connect_errno"]=> int(0) ["connect_error"]=> string(0) "" ["errno"]=> int(0) ["error"]=> string(0) "" ["field_count"]=> int(0) ["host_info"]=> string(37) "MySQL host info: localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(20) "5.1.36-community-log" ["server_version"]=> int(50136) ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(10) ["warning_count"]=> int(0) }
Ligne 10 de config :
mysql_select_db($SQLBase, $link1);
Ligne 21 de config :
mysql_select_db($SQLBase, $link2);
avec mysql
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 $config = array( 'server1' => array( 'host' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'test'), 'server2' => array( 'host' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'test') ); $sql = 'SELECT * FROM test LIMIT 1'; //mysql ini_set('mysql.trace_mode', true); $dbh1 = mysql_connect($config['server1']['host'], $config['server1']['user'], $config['server1']['password']); $db1 = mysql_select_db($config['server1']['database'], $dbh1); $dbh2 = mysql_connect($config['server2']['host'], $config['server2']['user'], $config['server2']['password']); $db2 = mysql_select_db($config['server2']['database'], $dbh2); $result = mysql_query($sql, $dbh1); while($data = mysql_fetch_assoc($result)) { print_r($data); } mysql_free_result($result); $result = mysql_query($sql, $dbh2); while($data = mysql_fetch_assoc($result)) { print_r($data); } mysql_free_result($result);
Bon, j'ai testé le même code ( $t = mysql_query("select nom_sas from sas;", $lien1); ) sur la version en ligne et ça marche donc je vais laisser la version locale tel quel.
Merci pour votre aide en tout cas.
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager