Jump to content

MySQL query with multiple search conditions


Jago6060

Recommended Posts

Trying to do a mysql query via php.  Here's the statement...

 

$month = date(n);
$day = date(j);
$year = date(Y);

$sql = "SELECT * FROM pec_mssgs WHERE length(text)>0 AND y=$year AND m=$month AND d>=$day";

 

Here's the problem: The table I'm searching has a separate field for day, month, and year, so the only way I could think of to get the values for each and match it to today's date, would be by the way I have it set above.  Is there an easier way to do this?  Currently this thows errors about not being able to jump to different rows.

  • 2 weeks later...

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.