Jump to content

multiple search -php&mysql-


wanted

Recommended Posts

I tried my best but it still cant solve. I hope u guys can help me. Here i've problem with how to do search in year & month using php & mysql. My problem is i'dont know how to take date ("d/m/Y") m(month) & Y(year) from my database. Format date ("d/m/Y"). Main idea is to display year first followed by month.It have 2 selection list, that is year(2008) & month(Jan-Dec). But i've done year first & still not getting anything.. this is my code

 

<?php

mysql_connect ("","","")or die (mysql_error());
mysql_select_db ("") or die (mysql_error());

$receivedDate = date ("d/m/Y");
$split = sprintf('%02d%02d%04d', $d, $m, $Y);
$d = $components[1];
$m = $components[2];
$Y = $components[3];

if ($_POST['selectOrder'] = "2008") {

$Y =$_POST['selectOrder'];
$sql = sprintf ("SELECT * FROM tbl_order WHERE [b]year[/b](receivedDate =) %d", $Y);
echo ($sql);

{
}

}

?>

<form action="" method="post" name="form1" id="form1">
<p align="center">
          <select name="selectOrder" id="selectOrder">
            <option selected="selected">- Year -</option>
            <option value="2008">2008</option>
   </select><br><br>
</p>
</form>

 

Link to comment
https://forums.phpfreaks.com/topic/88144-multiple-search-phpmysql/
Share on other sites

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.