Skip to main content
Aug 11, 2008 4:28 PM UTC
Question

using UPDATE on a test server

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
Aug 11, 2008 5:11 PM UTC
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/
Translate
Aug 11, 2008 5:50 PM UTC
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!
Translate