Bullwinkle
Bullwinkle

Reputation: 89

MySQL query with date parameter

My table in mysql has special data stamp (startdata). It is date when event starts. Older events stored in database to, but i don't need them to appear in the MySQL answer. So is there any way sending query to database that includes parameter i need? (for example, not showing rows where startdate older than today).

Now my code looks like:

$res3 = mysqli_query($con,"SELECT * FROM raspisanie WHERE
instr='" . $instrument . "' AND school IN(" . $array2 . ") 
AND type='regular' AND state='1' ORDER by startdate");

Upvotes: 0

Views: 216

Answers (1)

Dave
Dave

Reputation: 76

Add condition in your where clause.

    $res3 = mysqli_query($con,"SELECT * FROM raspisanie WHERE
    instr='" . $instrument . "' AND school IN(" . $array2 . ") 
    AND type='regular' AND state='1' AND startdate >now() ORDER by startdate");

Upvotes: 1

Related Questions