Sho Locus
Sho Locus

Reputation: 21

Select in postgresql using php

I cant properly select some data in the database i made. I used postgresql. The error says "Error in SQL query: ERROR: relation "book_flight.customer" does not exist LINE 1: SELECT idno FROM book_flight.customer ^" I tried removing the book_flight, still doesn't work

here is the code:

<?php  

    $db = pg_connect("host=localhost port=5432 dbname=AIRLINE user=postgres password=code");  
    echo 'Connected to: ', pg_dbname($db);

    $result = pg_query($db, "SELECT idno FROM book_flight.customer");
    if (!$result) {
        die("Error in SQL query: " . pg_last_error());
    } 

?> 

table customer is in the schema named book_flight

Upvotes: 1

Views: 1018

Answers (2)

Sho Locus
Sho Locus

Reputation: 21

I changed the database name, schema, and table name to small letters. It works. Seems that postgresql changes all to lower case and is case sensitive

Upvotes: 1

asantaballa
asantaballa

Reputation: 4048

Take a look at this, sounds like names may be case sensitive.

Cannot simply use PostgreSQL table name ("relation does not exist")

Upvotes: 1

Related Questions