Jump to content

upudating database


droidus

Recommended Posts

having the sprintf in there kinda throws me off.  otherwise, i would understand how to do it. :P

 

With sprintf the %s you embed gets replaced with the value of the parameter you provide, while also being conformed to the formatting specified.  '%s' just specifies that it needs to be a string, so I don't see a lot of value to using it here over using concatenation. 

 

Done what Zanus suggests is not a bad idea, because you can var_dump($q) and see if it's a valid sql statement if you want, however your main mistake as he also pointed out is that with updates there is no VALUES keyword.  You do

 

SET columname = the_value

 

And if you have multiple columns to update

 

SET columnname1 = a value, columname2 = another value, etc...

 

If your syntax had been correct it would have worked even doing it the original way you had it.

Link to comment
https://forums.phpfreaks.com/topic/240322-upudating-database/#findComment-1234537
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.