Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update statement in form with PHP and postgreSQL

Status
Not open for further replies.

jisoo22

Programmer
Joined
Apr 30, 2001
Messages
277
Location
US
Hello all,

I'm having trouble updating a row in my database via a form. Here's a snippet of what I'm trying to do:

$update = "UPDATE table1 SET (name, home_addy) = ('$_POST[name]', '$_POST[home_addy]') WHERE name = '$_POST[name]');

$execUpdate = pg_query($connection, $update);

I get an error saying that there's a parse error. I've traced this error to the "WHERE" clause. For some reason, it's not picking up the name entered from the previous form. Anyone have any ideas?

Thanks,
Jisoo22
 
in your original query remove the ")" at the last (after where clause)...
try this:
$update = "UPDATE table1 SET name='$_POST[name]',home_addy= '$_POST[home_addy]' WHERE name = '$_POST[name]';


Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top