Jump to content


Photo

Where Exists Help


  • Please log in to reply
2 replies to this topic

#1 emmy

emmy

    Member

  • Members
  • PipPip
  • 12 posts

Posted 31 October 2012 - 04:40 PM

I am having the same issue here but on postgreSQL database. I keep getting SYNTAX ERROR error at the update line, please can someone help

$query = "Select * from fieldtally where 'pipeno' = $pipeno;
BEGIN;
INSERT INTO fieldtally(pipeno,wthick,djointno,heatno1)VALUES('$pipeno','$wthick','$djointno','$heatno1'); WHERE EXIST, UPDATE fieldtally set 'pipeno'=$pipeno,'wthick'=$wthick,'djointno'=$djointno,'heatno1'=$heatno1);
END";




#2 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 24 January 2013 - 07:41 AM

Try to remove the single quotes around the field names.
Keeping it simple.

#3 vinny42

vinny42

    Advanced Member

  • Members
  • PipPipPip
  • 414 posts

Posted 12 August 2013 - 01:00 PM

The quotes around the fieldnames are wrong, but not a syntax error.

 

The error is in the WHERE EXISTS that just appears in the middle of nowhere:

 

INSERT INTO fieldtally(pipeno,wthick,djointno,heatno1)VALUES('$pipeno','$wthick','$djointno','$heatno1'); WHERE EXIST, UPDATE fieldtally set 'pipeno'=$pipeno,'wthick'=$wthick,'djointno'=$djointno,'heatno1'=$heatno1);

 

I think you've been writing a query using English grammer rather than SQL grammer. :happy-04:

 

What are you trying to do with the query?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com