Jump to content

Recommended Posts

$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;

Link to comment
https://forums.phpfreaks.com/topic/64361-solved-need-program-flow-explained/
Share on other sites

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.