Raivis.purins Posted March 23, 2009 Report Share Posted March 23, 2009 //------------------------------- 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! Quote Link to comment Share on other sites More sharing options...
Raivis.purins Posted March 23, 2009 Author Report Share Posted March 23, 2009 ? Quote Link to comment Share on other sites More sharing options...
marcis Posted March 23, 2009 Report Share Posted March 23, 2009 Drošvien, ka pēc šīs $res=mysql_query($qry); rindiņas. Tev pat mainīgie sakrīt, būtu vismaz paeksperimentējis ;) Quote Link to comment Share on other sites More sharing options...
Raivis.purins Posted March 23, 2009 Author Report Share Posted March 23, 2009 Es mainīgos saliku, tikai man ar pierakstu ir padraņķīgi, nemāku pareizi urakstīt. Vienkārīi nezinu, kā tagad būt? Rakstīt if() else vai kā? Quote Link to comment Share on other sites More sharing options...
codez Posted March 23, 2009 Report Share Posted March 23, 2009 http://lv.php.net/manual/en/control-structures.else.php Quote Link to comment Share on other sites More sharing options...
Raivis.purins Posted March 23, 2009 Author Report Share Posted March 23, 2009 MAn kaut kas tur nesanāk, ieraksts, par to, ka šodien ierakstu nav rādās visu laiku Quote Link to comment Share on other sites More sharing options...
bubu Posted March 23, 2009 Report Share Posted March 23, 2009 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ā :) Quote Link to comment Share on other sites More sharing options...
Raivis.purins Posted March 23, 2009 Author Report Share Posted March 23, 2009 Galu galā jau tiku skaidrībā, paldies par palīdzību! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.