Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

I have database name "TestDB" and under that I have table called "User". Above TestDB database and User table have been created in both mysql and postgres.

I have written the following code. it is working for mysql & not working for postgres.

/* The below code is show the output as array with currentuser key value property / (this is if we execute directly @ postgres prompt it will give the current user query result/ not the actual table located inside the Testdb */

php code

     include('adodb/adodb.inc.php');

     $db = ADONewConnection("mysql"); # eg 'mysql' or 'postgres'

     $db->debug = true;

     $db->Connect(localhost, "mysql", "mysql123","TestDB");

     $rs = $db->Execute('select * from User');

     print "<pre>";

     print_r($rs->GetRows());

     print "</pre>";

     $db1 = ADONewConnection("postgres"); # eg 'mysql' or 'postgres'

     $db1->debug = true;

     $db->Connect(localhost, "postgres", "postgres123","TestDB");

     $rs = $db->Execute('select * from User');

     print "<pre>";

     print_r($rs->GetRows());

     print "</pre>";

Please suggest me what to do this.

share|improve this question
    
I think you posted the same code snippets twice? –  Mark Winterbottom Oct 22 '13 at 6:48

1 Answer 1

As answered here, PostgreSQL defaults to lower case characters while being case sensitive with column and table names.

After the PostgreSQL connection, you could try the following:

$rs = $db->Execute('select * from "User"');
share|improve this answer
    
fine. it worked. But in this case I can't write single code for mysql as well as postgressql. is it ? how to resolve that? –  user2822934 Oct 23 '13 at 16:36
    
You could use only lower case in column and table names. –  Edakos Oct 23 '13 at 18:45
    
Now I have used only lowercase letters for database,tablename,columns. still it is not displaying respective table user –  user2822934 Oct 24 '13 at 17:20
    
That is always tricky. Instead do you have consider to use some kind of ORM library, as RedBean? Or a full framework, as Laravel? –  Edakos Oct 24 '13 at 20:05
    
yes it is working now. i recreated all the database names,tables,column names in lowercase. –  user2822934 Nov 2 '13 at 16:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.