date format

in table I have datum as date field. and I want to display table with month of datum variable. This is what I have now,


[php]rstvt= mysql_query("select * from ( intval(date_format(datum,‘m’)) as periodd,max(vt) as rsvt from rezije group by intval(date_format(datum,‘m’)) ");

// $result = mysqli_query($con,“SELECT * FROM Persons”);

// summary
echo ‘

’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
$s0 = “[‘periodd’, ‘rsvt’]”;

while($row = mysql_fetch_array($rstvt))
{
echo ‘

’;
echo ‘’;
echo ‘’;
$s0 = “$s0,[ $row[periodd],$row[rsvt] ]” ;
echo ‘’;
}

echo ‘

Godina-mjesecVT
’.$row[‘periodd’] .’’.$row[‘rsvt’] .’
’;[/php]

waht is function to take month as integer value ?

OpzMaster: Edited to have code in php code encapsulation.

First your query is wrong, you can’t use from in that way…

[php] rstvt= mysql_query("select * from ( intval(date_format(datum,‘m’)) as periodd,max(vt) as rsvt from rezije group by intval(date_format(datum,‘m’)) ");[/php]

It should be something like this.

[php] rstvt= mysql_query("select month(date_format(datum,‘m’)) as periodd,max(vt) as rsvt from rezije group by month(date_format(datum,‘m’)) ");[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service