php - Mysql Data for month and year -


i have datepicker selected date post data day, month, , year. have "by day" working, can't seem month , year click... here code works day.

    <?php   $choice = (isset($_post['choice'])) ? date("y-m-d",strtotime($_post['choice'])) : date("y-m-d");  $con = mysql_connect("localhost","root","xxxxxxxxxx");   if (!$con)  {   die('could not connect: ' . mysql_error());   }   mysql_select_db("inverters", $con);    $sql = "select sum(power) choice feed date = '".$choice."'";  $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error());  $row = mysql_fetch_assoc($res);  echo $row['choice'].'<br />';   ?> 

thanks,

alan

not sure if understood want do, if want display data given month, following sql query should work:

$sql = 'select . . . month(date) = [month picked] , year(date) = [year picked]'; 

hope helps.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -