Your PHP code for the server 1 is not the same with the code for the server
2 or the names of the tables from MySQL server 1 are not the same with the
value of your PHP queries.

Put the first PHP not-working query in the command-line for server 1 and see
if it works.

Put here the PHP code for the first not-working query.
Add, also, the real names of the MySQL tables used in your lines.

Iulian
----- Original Message -----
From: "Thomas Deliduka" <[EMAIL PROTECTED]>
To: "m a b" <[EMAIL PROTECTED]>
Sent: Monday, August 18, 2003 5:47 PM
Subject: Re: Server to Server Connection


> The table is in the SQL statement. "Select * from table_name"   If you
> really want my code it's very long. I will paste in the stuff that's
> relevant. It's at the bottom.
>
> If it's a PHP matter why does the same code connecting to a 3.23 server
work
> perfectly fine.  This same EXACT code works perfectly with the site that
is
> on server 2 (i.e. connecting via localhost NOT server to server).
>
> My code:
> --------------------------
> /* This is the code to connect to the database.  $dh: host, $du: user,
$dp:
> password, $db: database.   Adding debug code showed all information that I
> wanted to pass was correctly passed.  */
> if ($config['pconn'] == 1) {
>         $conn = @mysql_pconnect($dh,$du,$dp);
>     } else {
>         $conn = @mysql_connect($dh,$du,$dp);
>     }
>     if (!$conn) {
>         echo "FATAL ERROR: No connection to database.<BR>";
>         $error = "FATAL ERROR: No connection to database.<BR>\nError: " .
> mysql_error() . "\nUsed:\n  host: " . $dh . "\n  user: " . $dp . "\n
pass:
> " . $dp;
>         emailadmin($error);
>         exit;
>     } else {
>         $dbs = @mysql_select_db($db, $conn);
>         if (!$dbs) {
>             echo "FATAL ERROR: Could not select database.<BR>";
>             $error = "FATAL ERROR: Could not select database.<BR>\nError:
"
> . mysql_error() . "\nUsed:\n  host: " . $dh . "\n  user: " . $du . "\n
> pass: " . $dp;
>             emailadmin($error);
>             exit;
>         } else {
>             return $conn;
>         }
>     }
> }
>
> /*function for performing the mysql_query() You will notice the commented
> out line there, that is the work-around that I employed to force the
> database name for all the tables (my application uses the xno_ prefix for
> all tables)  I should not have to do that. */
>
> function db_query($query, $dconn = false) {
>     global $conn, $config;
>     if (!$conn) {         // if connection isn't there, connect to db
>         $conn = db_connect($config);
>     }
>     if (!$dconn) $dconn = $conn;  file://if $dconn is false (not using a
>                                   file://different connection) then set
it.
>
>     file://$query = str_replace("xno_",$config["dbname"].".xno_",$query);
>     $ret = @mysql_query($query, $dconn);
>     echo db_error(0)."<br>";      file://my debug code.
>     return $ret;
> }
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to