-
Posts
30 -
Joined
-
Last visited
Never
Posts posted by mikePhp
-
-
You are going to need to post the relevant code. It is likely that you are reusing a variable someplace, resulting in queries overwriting each other.
The relevant code was in my first post mate, i was using aray's to get through the process, but i think it is connecitng to the first connection and then overwriting on the second connection.
-
$connection2 - mysql_connect($hostname, $user[1], $pass[1]);
$connection2 = mysql_connect($hostname, $user[1], $pass[1]);
might have just been a typo here on the forums but be sure that that '-' is a '=' in your code.
yea matey, just a typo
I cant seem to get both connections on the same page to display there quiers, one seems to overwrite the other...??
-
$link = mysql_connect($h, $u, $p) or die(mysql_error());
$link2 = mysql_connect($h2, $u2, $p2) or die(mysql_error());
example: mysql_query($query, $link);
----------------
Now playing: Red Hot Chili Peppers - Breaking The Girl
via FoxyTunes
Cheers Matey,
Tried that but doesn't seem to work....
This is what i put.
$database = array('db1','db2'); $user =array('user1','user2'); $pass = array('pass1','pass2'); $connection = mysql_connect($hostname, $user[0], $pass[0]); $connection2 - mysql_connect($hostname, $user[1], $pass[1]); if((!connection) || (!$connection2)) { $noCon = 'Sorry there has been an issue connecting to the database'; } else { mysql_select_db($database[0], $connection); mysql_select_db($database[1], $connection2); } }
I have separate queries for either connection,
But only one of the queries has completed,
Do you thing one is overwriting the other...??
Cheers
Mike
-
Hiya
i am currently trying to access 2 different DB's on the same host, but they have different pass's and user names, on the same page.
I am getting a connection, But the second connection is OVERWRITING the first Query, so i am only seeing the display on the mainpage of the second DB Query
I am putting the INFO in to ARRAYS and then calling them I.e
$database = array('db1','db2'); $user =array('user1','user2'); $pass = array('pass1','pass2'); for($i=0; $i<count($database) && $i<count($user) && $i<count($pass); $i++) { $connection = mysql_connect($hostname, $user[$i], $pass[$i]); } if(!connection) { $noCon = 'Sorry there has been an issue connecting to the database'; } else { for($i=0; $i<count($database); $i++) { mysql_select_db($database[$i], $connection); } }
Now i did try the:
foreach($user as $newUser) { }
but i needed to get the rest of the foreach's then if you get me...
I hope you can help in some sort of way matey
cheers
Mike
[SOLVED] Multiple Mysql Connections on one Page
in MySQL Help
Posted
right this is the code what i have got
I am calling am function in
My Index.php is the main page for all my pages, it calls the content of the rest of my pages,
http://www.planet-group.co.uk/magazines/foodanddrink/index.php
you will understand and these are the queries from the home page..
have a look....??