Hi guys I am trying to build a fairly simple (I think) database.

I am currently having a few problems with getting foriegn keys to work, or even be created.

Here is the code I am trying to run:

$con = pg_connect("host=xxx        
port=5432 dbname=xxx user=xxx
if (!$con)
die('Could not connect: ' . pg_last_error());    

$query = "CREATE TABLE bookings      
hair_service  REFERENCES
hair_services(hair_service_description)  , 

$res = pg_query ($con, $query);
if ($res)
echo "Table creation succeeded.";
} else {
echo "Table creation failed.";

The error I get when trying to run this is :

Query failed: ERROR: syntax error at or near "REFERENCES" LINE 3: hair_service REFERENCES hair_services(hair_service_descript... ^

Have you guys got any ideas as to why this happens? Cant for the life of me find any syntax errors!

Would really appreciate some help!

Thanks for your time!