Jump to content
php.lv forumi

Palīdzat ar sql un datumiem


genau

Recommended Posts

$date=date("d.m.Y");

$z=date("n",strtotime($date));

...

$count = mysql_query("SELECT COUNT(title) FROM article WHERE dtime='$z'");

 

while($row = mysql_fetch_assoc($count)){

echo $row['COUNT(title)'];

}

 

Jāatlasa virsrakstu skaits padotajā mēnesī, šajā gadījumā aprīlī.

Link to comment
Share on other sites

Datums ir datetime formātā, date(Y-m-d) ir tikai piemērs, mainīgajā $z ir ierakstīta vērtība - mēnesis ar vienu ciparu, piem 4, vai vispār es varu šādi salīdzināt $z ar dtime queryā, pēc bubu ieteikuma man jāpārveido visa f-ja(paldies par ieteikumu), tādēļ es to nevēlētos izmantot.

Edited by genau
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...