
March 31st, 2012, 01:52 PM
|
|
Registered User
|
|
Join Date: Mar 2012
Posts: 1
Time spent in forums: 22 m 34 sec
Reputation Power: 0
|
|
|
REFERENCES problem
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:
Code:
<?php
$con = pg_connect("host=xxx
port=5432 dbname=xxx user=xxx
password=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 :
Code:
Original
- Code |
|
|
|
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!
Tom
|