Skip to main content
August 11, 2008
Question

using UPDATE on a test server

  • August 11, 2008
  • 1 reply
  • 241 views
I'm trying to use the UPDATE command to update a record on a (test) server. I don't get any errors but I can't seem to get the UPDATE command to actually update the data. I wondered if the mysql_query function needed a reference to the database? Any ideas? R
This topic has been closed for replies.

1 reply

Inspiring
August 11, 2008
findhorn wrote:
> I wondered if the mysql_query function needed a reference to
> the database?

No, mysql_query() just needs the query. Your problem lies with quotes in
the query itself. A couple of the values are not in quotes. There should
also not be a comma before WHERE.

$query_updateAvailability = "UPDATE tbl_availability
SET satStatus='".mysql_real_escape_string($_POST['satStatus'])."',
sunStatus='".mysql_real_escape_string($_POST['sunStatus'])."'
WHERE
availabilityId='".mysql_real_escape_string($_POST['availabilityId'])."'";


--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
August 11, 2008
Excellent! I noticed the comma but not the quotes. Strangely enough, the quotes were missing from the DW book and example code that I looked up! Maybe there is more than one way to right this!? Anyway, the changes work. Thanks!