Variable inside the Select

Asked

Viewed 95 times

0

On my Web system I have the following select:

SELECT round(SUM(peso),3) FROM mov02s WHERE modal = ('Carreta simples') AND data = ('2018-05-16')

I would like to use a variable instead of '2018-05-16'. The user who will choose the date.

I thought of doing a date input with javascript:

<input type="date" id="myDate" value="2018-06-26" />

But I haven’t been able to evolve yet. I couldn’t get the variable.

  • What language are you using for backend? PHP? You don’t have this information either in the tag or in the question.

  • Yes you must have an input, which will then be passed to your code, within your code you will have a variable that will receive that date, which will only then add your query.. What programming language are you using? What else have you developed? Add other codes.

  • If it is php and only gives a prepare, then passes the variable and then executes. As you send this date, it can be by post or by javascript.

  • The language used is php. I am using the Laravel framework

  • Put in the question the snippet of your controller that receives the form submission with the mydate input so we can help better. There are different ways to do, if you show the path you are taking will make it easy to give a code hint.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.