Page 1 of 1

Point my code to a remote db

Posted: Tue Apr 01, 2008 10:26 am
by jcor
Hi, My company has this site and I copied all the php code to my PC to make a few tests.

I installed appserv, created a db in phpmyadmin, imported the tables from the original db and some data to (not all because it's too much).

Here started my problems. The site in my local host has some character issues so it make querys looking for tables with these special characters. So, instead of a list of lines from my tables I get this in my page:

Code: Select all

SELECT noticias.data™Data™bd™editar.php?tipo=$tipo&id=valor_id&filtro=$filtro™™
FROM noticias™™id™
WHERE 1=1 AND tipo=1 
 
Error: noticias™™id™' doesn't exist
I don't know if the problem is that I imported a db from linux and trying to use it in windows, or maybe the problem is not in the db but in the query generated in the site. Some help in this would be great.

One other option is to point my code to the original, remote db. I have this php code:

Code: Select all

session_start();
 
// DB do Site
//***********************************
    Class config {
        var $db;
        var $login;
        var $senha;
        var $odbc;
        var $driver;
        var $servidor;
 
        Function config () {
            $this->db       = "db";
            $this->login    = "user";
            $this->senha    = "pwd";
            $this->odbc     = "";
            $this->driver   = "";
            $this->servidor = "localhost";
        }
    }
 
what should I change here (or somewhere else) to get the data from the remote db?


TIA for any help,


João

Re: Point my code to a remote db

Posted: Tue Apr 01, 2008 5:10 pm
by flying_circus
I cant help with the character issue, I just dont know enough about it.

To get the code to point to your remote DB you'd need to change your server variable:

$this->servidor = "www.mywebserver.com";

then on the remote server GRANT permission from your external IP.

However, it's not a very good solution, and you should try to figure out your character/multi-lingual code issue.