Jump to content

str_to_date Problem


mr cracker

Recommended Posts

Hello.

 

I´m having a problem with this Query: 

 

$fecha=$_POST['fecha'];

$result = mysql_query("SELECT * FROM tbl_ventas WHERE fecha = (str_to_date('$fecha', '%d/%m/%Y')");

 

but it returns an error in MYSQL Syntax.

 

The variable $fecha contains the date the user selects from a calendar in this format  in example: 1-5-2010  (d/m/y).

i want to convert that date format into MySQL´s YYYY-mm-dd so i can then select only the matching records in the table tbl_ventas.  ::)

 

THANKS!

Link to comment
https://forums.phpfreaks.com/topic/200412-str_to_date-problem/
Share on other sites

You have an extra ( in your query before the mysql str_to_data() function that is probably producing a sql syntax error. It would help if you post errors you are getting as they generally point to where a problem is occurring at and result in quicker solutions.

Link to comment
https://forums.phpfreaks.com/topic/200412-str_to_date-problem/#findComment-1051716
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.