Jump to content

quotation nightmare


jeff5656

Recommended Posts

I have the " or the ' all wrong.  Can someone tell me how to do the quoation marks correctly so I dont get a syntax error:

 

as can be seen, the date 10/5/14 is not a variable but I want to convert it to a format that can go into a DATE field.

 

$query = "update table set expir_date = date("Y-m-d", 10/5/14) where id = '$id' ";

Link to comment
https://forums.phpfreaks.com/topic/233000-quotation-nightmare/
Share on other sites

Wait, don't I need strtotime?  I got 0000-00-00 when I did that.  Where would the quotes go:

 

like this?

 

$query = "update table set expir_date = '" . date("Y-m-d", strtotime("10/5/14")) . "' where id = '$id' ";

Yes sorry, like that.  Echo out $query to see exactly what the string looks like, it will give you a better idea.

Link to comment
https://forums.phpfreaks.com/topic/233000-quotation-nightmare/#findComment-1198362
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.