Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

using UPDATE on a test server

Guest
Aug 11, 2008 Aug 11, 2008
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
TOPICS
Server side applications
242
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 11, 2008 Aug 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 11, 2008 Aug 11, 2008
LATEST
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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines