PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 31st, 2012, 01:52 PM
tomryan89 tomryan89 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 1 tomryan89 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > REFERENCES problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap