Jump to content
php.lv forumi

gribu vienu ifu ielikt


Raivis.purins

Recommended Posts

//------------------------------- SHODIENA ------------------------------------------
print  '<h3>'.$translate['calendar_today_title'].'</h3>'."\n";
$qry = "SELECT * from `".$thisSelectionDb."` where mdate>=".strtotime('today 00:00')." AND mdate<".strtotime('today 23:59')." AND	parent=".$newsLanId." AND active='on' AND visible='on' ORDER BY sticky desc, position";
$res=mysql_query($qry);
while ($row=mysql_fetch_array($res)){
	print '<div class="news" style="margin:10px;padding:10px;">';

 

Ideja sekojoša, gribu ielikt if steitmentu

ja šodien calendārā ieraksta nav printējam ārā ierakstu

 

if (mysql_num_rows($res)<1) print print  '<h3>'.$translate['calendar_today_off'].'</h3>';

 

kur es šito varu ieķeksēt?

 

Pateicos!

Link to comment
Share on other sites

Sintakse ir sekojoša:

if (nosacījums)
{
kods, kas izpildās, ja nosacījums ir patiess
}
else
{
citādi izpildās šis kods
}

 

Tavā gadījumā nosacījums ir, ka izselektēto rindu skaits = 0 (vai <1 - tas tas pats).

Atliek salikt kopā :)

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...