Jump to content

Two mysql connections

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Blaze

Blaze

    Programmer

  • Members
  • PipPipPipPip
  • 117 posts
Do I need to create two mySQL connections for this?


$db = mysql_connect($server,$username,$pass);

$query = "SELECT * FROM test";


$results = mysql_query($query);


while ($row = mysql_fetch_array($results) {

      $query = "SELECT * FROM test2";

       $results = mysql_query($query);

}


or will this bomb out?

#2
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
Ehhhh, Dont see what this code is supposed to do, but it wont work with what you have
$db = mysql_connect($server,$username,$pass);
$query = "SELECT * FROM test";

$results = mysql_query($query);

while ($row = mysql_fetch_array($results)  //<-This $result is getting overwritten by the following
{
      $query = "SELECT * FROM test2";
       $results = mysql_query($query); //<-SO simply change to something else, ie $result2
} 


#3
Blaze

Blaze

    Programmer

  • Members
  • PipPipPipPip
  • 117 posts
Yours won't work either (missing a ) on the while. Thanks for your help. I'll give that a try.