Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.