开发者

Combine two Mysql select statement

开发者 https://www.devze.com 2023-03-04 15:10 出处:网络
I have a select statement like..... (1) $today = date(\'D, d M, Y\'); $sql = \"SELECT * FROM tables WHERE date = \'$today\'\";

I have a select statement like.....

(1) $today = date('D, d M, Y');
$sql = "SELECT * FROM tables WHERE date = '$today'";

Its working fine and getting the output....

And I have an input field in the same page like....

<form method="post">
    <input type="text" id="dt1" onchange="this.form.submit()" name="dt1" value="dt1"/>
</form>

And this input joined with a datepicker....

My aim is show today's data and while changing the datepicker show data on the particular date in the same page....

I given the select statement for this input is....

(2) $mydt = my开发者_如何学编程sql_real_escape_string($_POST['dt1']); $sql = "SELECT FROM tables WHERE date = '$mydt'";

Independently (1) and (2) are working fine...

How will I join (1) and (2)...

That means I want to get todays data and while changing date picker i want to show that particular data of that date....


Your question is a little bit confusing but I think what you need is this:

SELECT * FROM tables WHERE date = '$today' OR date = '$mydt';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号