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

I am trying to change an app from MySQL to Postgres so that we can run it on Heroku.

So at this point I am pretty sure I am connecting to the DB successfully and just trying to run a super simple query, but it is not displaying any rows. Any idea what i might be missing here

    $pgConnect = pg_connect("host=[[link to host which is amazon aws url]] dbname=[[dbname]] user=[[username]] password=[[password]]");

    $result=pg_query($pgConnect, "SELECT * FROM formdata");
    if  (!$result) {
     echo "query did not execute";
    }
    if (pg_num_rows($result) == 0) {
     echo "0 records"
    }
    else {
      while ($row = pg_fetch_array($result) {
        echo $row;
      }
    }

I am not even getting "query did not execute".

share|improve this question
1  
Now might be a good time to switch to PDO –  Steve Nov 6 at 16:47
    
I was actually just reading about PDO it is gonna break the norm for me :) but i think you are right –  Travis Nov 6 at 16:49
    
Using PDO isolates you from a lot of the low-level junk you're dealing with here. –  tadman Nov 6 at 17:30
    
Thanks for the recommendation on PDO i am going to venture down that path –  Travis Nov 6 at 18:18
    
PDO is a piece of junk one might use only for database abstraction purposes. It does not only halve the performances but also cut you from interesting functionnalities like asynch. queries, scrollable cursors, listen notify support and much more. –  greg Nov 13 at 19:45

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.