Emmett Posted August 11, 2007 Share Posted August 11, 2007 $j = 1; for ($i = $startDay; $i <= 6; $i++) { $qr = 0; // the day = $i, so set a number & query the DB for this day if ($j < 10 AND !ereg("^0",$j)) { $q = "0".$j; } else { $q = $j; } // this is the query results counter $qr = 0; echo "<td nowrap valign=\"top\"><font size=\"-1\"> <a href=\"./day.php?LocationID=$LocationID&Date=".$Year."-".$Month."-".$q."\"> <b>$j</b></a><p>"; I have been trying to <style>$j in this echo statement but have only been able to effect the 2nd and beyond. The 1st day of the month has totally got me stumped. The db query must happen before this echo statement but I completely do not understand how that happens. I would also like to know why there are 2 $qr=0; Quote Link to comment https://forums.phpfreaks.com/topic/64361-solved-need-program-flow-explained/ Share on other sites More sharing options...
cooldude832 Posted August 11, 2007 Share Posted August 11, 2007 What you have a eregi to compare to a integer??? That is pointless and a waste of resources. Secondly You cut this so thight We can't tell what it is doing. Quote Link to comment https://forums.phpfreaks.com/topic/64361-solved-need-program-flow-explained/#findComment-320928 Share on other sites More sharing options...
Emmett Posted August 11, 2007 Author Share Posted August 11, 2007 I figured it out: Just move this code: echo "<td nowrap valign=\"top\"><font size=\"-1\"> <a href=\"./day.php?LocationID=$LocationID&Date=".$Year."-".$Month."-".$q."\"> <b>$j</b></a><p>"; to the bottom of this code: for ($i = $startDay; $i <= 6; $i++) { Then create a control variable such as $got and place it here: $got=""; if ($query) { $got="hit"; then finish it up with an "if" statement to gain control of the <style> of the "$j" variable which is the day of the week like so: If($got){ echo "<td align=\"center\" nowrap valign=\"top\"> <a href=\"./day.php?LocationID=$LocationID&Date=".$Year."-".$Month."-".$q."\"><b><font color=red>$j</font></b></a>"; }else{ echo "<td align=\"center\" nowrap valign=\"top\"> <a href=\"./day.php?LocationID=$LocationID&Date=".$Year."-".$Month."-".$q."\"><b>$j</b></a>"; } No I can get rid of the <font> tag and put in a css class into the <td> tag. Done! Quote Link to comment https://forums.phpfreaks.com/topic/64361-solved-need-program-flow-explained/#findComment-321257 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.