jrm
Members-
Posts
33 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
jrm's Achievements
Member (2/5)
0
Reputation
-
Now, this works for me, as our week starts on Fri, not Sun, and takes in account of the day light savings time issues. This takes an array of dates from a mysql query, and displays them in a calendar style view $cDates = count($Dates); for($k = 1; $k <= $cDates-2; $k++) { $t = $k; $p = $t + 1; $start = strtotime($Dates[$k]["DTG"]); $stop = strtotime($Dates[$p]["DTG"]); $dayTotal = ($stop - $start)/24/60/60; $date = date("Y-m-d", $start); // starting date (YYYY-MM-DD) $temp = date("Y-m-d", $stop); // ending date (YYYY-MM-DD) $end = date("Y-m-d",strtotime("-1 day",$stop)); echo "\n<table style=\"align:center;width:100%;\">"; echo "\n <tr>"; echo "\n <th colspan=\"7\" align=\"center\"><strong>"; echo "\n </strong></th>"; echo "\n </tr>"; echo "\n <tr>"; echo "\n <th>Fri</th>"; echo "\n <th>Sat</th>"; echo "\n <th>Sun</th>"; echo "\n <th>Mon</th>"; echo "\n <th>Tue</th>"; echo "\n <th>Wed</th>"; echo "\n <th>Thu</th>"; echo "\n </tr>"; echo "\n <tr>"; $offset = date("w", strtotime($date)); if($offset <= 4) // to add spaces to beginning of row { for($i = 0; $i <= $offset+1; $i++){echo "\n <td><br /></td>";} $count = $offset+2; } else { $count = 0; } while($date <= $end) { echo "\n <td>" . date("d M", strtotime($date)) ."::". date("w",strtotime($date)). "</td>"; $date = date('Y-m-d',strtotime("$date +1 day")); // get the next date if($count >= 6) // to set next row { $count = 0; echo "\n </tr><tr>"; } else { $count++; } } for($i = $count; $i <= 6; $i++){echo "\n <td><br /></td>";}// to add spaces at end of row echo "\n </tr>"; echo "\n</table>"; }
-
Thanks btherl for the info on the dst. After looking at it, I decided to look at past years, and the same thing happens every year that I have info for on those dst dates. Thank you also PFMaBiSmAd for the loop. Although I am having trouble making the format with it. I am still working on it.
-
Does March 13 2011 not exist in the php Date object? I have included my code for a calendar to display info based on a week Fri-Thur. It does great except for Mar13. Also Mar 14, 2010 seams to be missing as well. What did I do wrong? function viewAllMerits() { $cDates = count($this->Cadet["Dates"]); echo "\n<br>class Merits::viewAllMerits::Dates=";print_r($this->Cadet["Dates"]); //echo "\n<br>class Merits::viewAllMerits:Merits=";print_r($this->Merits); for($k = 1; $k <= $cDates-2; $k++) { $t = $k; $p = $t + 1; $start = strtotime($this->Cadet["Dates"][$k]["DTG"]); $stop = strtotime($this->Cadet["Dates"][$p]["DTG"]); $phase = $this->Cadet["Dates"][$k]["Type"]; $dayTotal = ($stop - $start)/60/60/24; $weekTotal = ceil($dayTotal/7)+1; //to correct not printing partial weeks echo "\n<table style=\"align:center;width:100%;\">"; echo "\n <tr>"; echo "\n <th colspan=\"7\" align=\"center\"><strong>"; echo "\n Merits earned during ". $phase ." from ". date("d M Y", $start) . " to " . date("d M Y",$stop-3600) . " "; echo "\n <br />Days in phase:". floor($dayTotal); echo "\n "; echo "\n </strong></th>"; echo "\n </tr>"; echo "\n <tr>"; echo "\n <th>Fri</th>"; echo "\n <th>Sat</th>"; echo "\n <th>Sun</th>"; echo "\n <th>Mon</th>"; echo "\n <th>Tue</th>"; echo "\n <th>Wed</th>"; echo "\n <th>Thu</th>"; echo "\n </tr>"; //echo "\n<br>class Merits::viewAllMerits:weekTotal=$weekTotal"; for($i = 0; $i < $weekTotal; $i++) { echo "\n <tr>"; for ($j = 1; $j <= 7; $j++) { $dayNum = ($j + $i*7 - date("w",$start))-2; //Print a cell with the day number in it. If it is today, highlight it. if ($dayNum > 0 && $dayNum <= $dayTotal) { $temp = $start+($dayNum*24*60*60)-3600; //$newdate = date("Y-m-d",$temp); //$id = $this->multi_array_search($newdate, $this->Merits[$phase]); //echo "\n<br>id=";print_r($id); //$link = ($id == false ? "N/A": $this->Merits[$phase]["Detail"][$id[1]]["Total"]); echo "\n <td>"; echo "\n <table>"; echo "\n <tr>"; echo "\n <th colspan=\"1\">". date("d-M",$temp) ."</th>"; echo "\n </tr>"; echo "\n <tr>"; //need to develop pop up for details //$test = "<a href=\"" . $_SERVER["PHP_SELF"] . "?outer=Cadets&id=" . $this->CadetID . "&inner=Merits\">$link</a>"; echo "\n <td>".$link."</td>"; echo "\n </tr>"; echo "\n </table>"; echo "\n </td>"; } else { //Print a blank cell if no date falls on that day, but the row is unfinished. echo "\n <td></td>"; } } echo "\n </tr>"; if ($dayNum >= $dayTotal && $i != 6) break; } echo "\n</table>"; } } data: class Merits::viewAllMerits::Dates=Array ( [0] => Array ( [Type] => Date of Entry [DTG] => 2010-10-19 [Comments] => ) [1] => Array ( [Type] => Orientation [DTG] => 2010-10-19 [Comments] => ) [2] => Array ( [Type] => 1st Phase [DTG] => 2010-11-19 [Comments] => ) [3] => Array ( [Type] => 2nd Phase [DTG] => 2011-02-18 [Comments] => ) [4] => Array ( [Type] => 3rd Phase [DTG] => 2011-05-20 [Comments] => PT PATCH ) [5] => Array ( [DTG] => 2011-07-19 ) )
-
Solved it with this function: function isEnrolled($CadetRoster, $StartDTG, $StopDTG) { $timeframe = 60*60*24*240; for($i = 0; $i <= count($CadetRoster) - 1; $i++) { $DoEntry = strtotime($CadetRoster[$i]["DoEntry"]); $DoExit = (!empty($CadetRoster[$i]["DoExit"]) ? strtotime($CadetRoster[$i]["DoExit"]) : $DoEntry + $timeframe); if(($DoEntry <= $StopDTG) == True) { if(($StartDTG <= $DoExit) == True) { $Enrolled[] = $CadetRoster[$i]; } } } return $Enrolled; }
-
I have been working on this problem for about a month and cannot figure it out. I had it working with MS Access for selecting one month, but I need to convert it over to php. So I start with this function: function EnrolledBetween($StartDTG, $StopDTG) { include "Connection.php"; $dropquery = "Drop Temporary Table If Exists test.t_CadetsDates;"; $dropresults = mysql_query($dropquery, $link) or die("\n<p> Could not run query : " . $dropquery . " : " . mysql_error()); $createquery = "Create Temporary Table test.t_CadetsDates Select Cadets.CadetID, Cadets.Last, (Select DTG From Cadets_be.CadetsDates Where SDID=11 and Cadets.CadetID = CadetsDates.CadetID) as DoEntry, (Select DTG From Cadets_be.CadetsDates Where SDID=6 and Cadets.CadetID = CadetsDates.CadetID) as DoExit From Cadets_be.Cadets Where Cadets.Last<>'Test' Order by Last, First, Middle;"; $result = mysql_query($createquery, $link) or die("\n<p> Could not run query : " . $createquery . " : " . mysql_error()); $query = "Select CadetID, DoEntry, DoExit From test.t_CadetsDates"; $result = mysql_query($query, $link) or die("\n<p>Could not run query : " . $query . " : " . mysql_error()); if(mysql_num_rows($result)==0) { $CadetList = NULL; } else { for($j = 0; $j <= mysql_num_rows($result)-1; $j++) { $newrow = mysql_fetch_array($result,MYSQL_NUM); for($m = 0; $m <= mysql_num_fields($result)-1 ; $m++) { $CadetList[$j][mysql_field_name($result, $m)] = $newrow[$m]; } } } if(is_array($CadetList)) { //print_r($CadetList); $results = isEnrolled($CadetList,$StartDTG, $StopDTG); return $CadetList; } else { //echo "\n<p>$CadetList</p>"; return "N/A"; } } Which basically makes a pivot table from my Cadets_be.Cadets, Cadets_be.CadetsDates tables. And sends it to another function ( which I can not figure out) to put the cadets that were enrolled between the two dates into is Enrolled[]. The problem is that it is not a simple isbetween($StartDateTime, $StopDateTime). There are four dates to deal with. Can anybody direct me onto the right path?
-
Yeah, I do not know what happened. But after about 20 mins, I pulled the intranet page and the data is there.
-
I am having a problem with records being skipped when I pull this query from my intranet server: SELECT Cadets.CadetID, Cadets.SSN, Cadets.Last, Cadets.First, Cadets.Middle, Date_Format(Cadets.DOB, '%d %b %Y') as DoB, Cadets.PhaseID, Cadets.Number, Year(CadetsDates.DTG) as SelectYear FROM Cadets_be.Cadets INNER JOIN Cadets_be.CadetsDates ON Cadets.CadetID = CadetsDates.CadetID WHERE (CadetsDates.SDID=11 and Year(CadetsDates.DTG)=2008) AND Cadets.Last<>'Test' ORDER BY Cadets.Last, Cadets.First, Cadets.Middle; There are three records that get skipped, for privacy reasons(juvenile records) I can not give the information. I have also pulled the data from MySQL Query Browser, MS Access, and from the terminal on the mysql server and I get 43 records. On the intranet server, I get 39??? I thought that it was with the JOIN, but I pulled the data for those that were not showing, and there are corresponding records. What else could be the problem? Be fore warned, I wrote this when I just started to write PHP, and I just haven't gone back to redo it. My codeing and commenting have gotten alot better. <HTML> <HEAD> <Title>Cadet Roster</Title> <link rel=stylesheet type="text/css" href="themes/theme.css"> </HEAD> <BODY background="/themes/subtxtr.gif"> <?php include "Functions.php"; // Original: Mike McGrath (mike_mcgrath@lineone.net) web Site: http://website.lineone.net/~mike_mcgrath include "CadetNameFunc.php"; include "CadetImageFunc.php"; ?> <p><font size = 4><a href = CadetNumbers.htm target = Info >Return to Cadet Roster</a></p> <?php // Get Past or Present Cadet Roster and Year if Past if(isset($_GET['PorP'])) { $PorP = (int) $_GET['PorP']; //echo "<p>" . $PorP . "</p>"; if(isset($_GET['year'])) { $SelectYear = (int)$_GET['year']; //echo "<p>" . $SelectYear . "</p>"; } else { echo "No Year Selected. Current Year Selected"; $SelectYear = date("Y"); } } else { echo 'No Time Frame selected!'; exit; } echo "<p><font size =3>Report Generated at: " . date("F j, Y, g:i a") . "</font></p>\n"; // set the Query based on Past or Present switch ($PorP) { case 1: //Current Cadets echo "<table width = '100%' ><tr><td align = center>Current Cadets</td></tr></table>\n"; $query = " SELECT Cadets.CadetID, Cadets.SSN, Cadets.Last, Cadets.First, Cadets.Middle, Date_Format(Cadets.DOB, '%d %b %Y') as DoB, Cadets.PhaseID, Cadets.Number FROM Cadets_be.Cadets WHERE Cadets.PhaseID<5 AND Cadets.Last<>'Test' ORDER BY Cadets.Last, Cadets.First, Cadets.Middle; "; break; case 2: //Former Cadets echo "<table width=100% ><tr><td align = center>Past Intakes for Year: " . $SelectYear . "</td></tr></table>\n"; $query = " SELECT Cadets.CadetID, Cadets.SSN, Cadets.Last, Cadets.First, Cadets.Middle, Date_Format(Cadets.DOB, '%d %b %Y') as DoB, Cadets.PhaseID, Cadets.Number, Year(CadetsDates.DTG) as SelectYear FROM Cadets_be.Cadets INNER JOIN Cadets_be.CadetsDates ON Cadets.CadetID = CadetsDates.CadetID WHERE (CadetsDates.SDID=11 and Year(CadetsDates.DTG)='" . $SelectYear ."') AND Cadets.Last<>'Test' ORDER BY Cadets.Last, Cadets.First, Cadets.Middle;"; break; case 3: //Aftercare Residents echo "<table width=100% ><tr><td align = center>Current Aftercare Residents</td></tr></table>\n"; $query = " SELECT Cadets.CadetID, Cadets.SSN, Cadets.Last, Cadets.First, Cadets.Middle, Date_Format(Cadets.DOB, '%d %b %Y') as DoB, Cadets.PhaseID, Cadets.Number FROM Cadets_be.Cadets WHERE Cadets.PhaseID=5 AND Cadets.Last<>'Test' ORDER BY Cadets.Last, Cadets.First, Cadets.Middle;"; break; } ?> <br> <table width="100%" border="2"> <tr> <td align = middle width = 2% ><big></big></td> <td align = middle width = 15% ><big>Name</big></td> <td align = middle width = 5% ><big>SSN</big></td> <td align = middle width = 8% ><big>Phase</big></td> <td align = middle width = 10% ><big>DOB</big></td> <td align = middle width = 10% ><big>Date of Entry</big> <td align = middle width = 10% ><big>Est Date of Exit</big></td> <td align = middle width = 5% ><big>Viol Ct</big></td> <td align = middle width = 5% ><big>PNC Ct</big></td> <td align = middle width = 20% ><big>Remarks</big></td> </tr> <?php // Get the Roster // Start Cadet Roster $result = mysql_query($query, $link) or die("Could not run Cadet Query: " . mysql_error()); $count = 0; while ($Cadets = mysql_fetch_array($result, MYSQL_ASSOC)) { $count += 1; $cadetid = $Cadets["CadetID"]; $Name = $Cadets["Last"] . ", " . $Cadets["First"] . " " . $Cadets["Middle"]; $CadetNum = $Cadets["Number"]; $fullSSN = str_split($Cadets["SSN"]); $Last4 = $fullSSN[7] . $fullSSN[8] . $fullSSN[9] . $fullSSN[10]; $Phaseid = $Cadets["PhaseID"]; $DOB = $Cadets["DoB"]=="" ? 0 : $Cadets["DoB"]; // for error checking echo "Getting Data for Cadet : " . $Cadets["Last"] . ", " . $Cadets["First"] . " " . $Cadets["Middle"]; switch(fmod($count,2)) { case 0: ?> <tr> <td align = center width = 2% > <? echo $count ?></td> <td align = center width = 15% > <a href="CadetDetails.php?CadetID=<? echo $cadetid ?>" onmouseover="popup('<? echo $imagepath ?>')" onmouseout="kill()" ><? echo $Name ?></a> </td> <td align = center width = 5% ><? echo $Last4?></td> <td align = center width = 8% ><? echo $CurPhase?></td> <td align = center width = 5% ><? echo $DOB ?></td> <td align = center width = 10% ><? echo $DoE ?></td> <td align = center width = 10% ><? echo $EstDoR ?></td> <td align = center width = 5% ><? echo $ViolCount ?></td> <td align = center width = 5% ><? echo $PNCCount ?></td> <td align = center width = 20% ><? echo $Remarks ?></td> </tr> <?php break; default: ?> <tr> <td bgcolor = lightgrey align = center width = 2% ><? echo $count ?></td> <td bgcolor = lightgrey align = center width = 15% > <a href="CadetDetails.php?CadetID=<? echo $cadetid ?>" onmouseover="popup('<? echo $imagepath ?> ')" onmouseout="kill()" ><? echo $Name ?></a> </td> <td bgcolor = lightgrey align = center width = 5% ><? echo $Last4 ?></td> <td bgcolor = lightgrey align = center width = 10% ><? echo $CurPhase ?></td> <td bgcolor = lightgrey align = center width = 10% ><? echo $DOB ?></td> <td bgcolor = lightgrey align = center width = 10% ><? echo $DoE ?></td> <td bgcolor = lightgrey align = center width = 10% ><? echo $EstDoR ?></td> <td bgcolor = lightgrey align = center width = 5% ><? echo $ViolCount ?></td> <td bgcolor = lightgrey align = center width = 5% ><? echo $PNCCount ?></td> <td bgcolor = lightgrey align = center width = 20% ><? echo $Remarks ?></td> </tr> <?php } } ?> </table> DROP TABLE IF EXISTS `Cadets_be`.`CadetsDates`; CREATE TABLE `Cadets_be`.`CadetsDates` ( `DateId` int(10) NOT NULL auto_increment, `CadetID` int(10) default NULL, `SDID` int(10) NOT NULL default '0', `DTG` date default NULL, `Comments` varchar(255) default NULL, `CurDTG` timestamp NOT NULL default CURRENT_TIMESTAMP, `User` varchar(50) default NULL, `Computer` varchar(50) default NULL, PRIMARY KEY (`DateId`), KEY `CadetID` (`CadetID`), KEY `Cadets DatesSDID` (`SDID`), KEY `DateId` (`DateId`) ) ENGINE=MyISAM AUTO_INCREMENT DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; DROP TABLE IF EXISTS `Cadets_be`.`SpecificDates`; CREATE TABLE `Cadets_be`.`SpecificDates` ( `SDID` int(10) NOT NULL auto_increment, `Classification` varchar(25) default NULL, `Level` int(10) default NULL, `CurDTG` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`SDID`), KEY `PhaseID` (`SDID`) ) ENGINE=MyISAM AUTO_INCREMENT DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; DROP TABLE IF EXISTS `Cadets_be`.`Cadets`; CREATE TABLE `Cadets_be`.`Cadets` ( `CadetID` int(10) NOT NULL auto_increment, `CurDTG` timestamp NOT NULL default CURRENT_TIMESTAMP, `CauseNumber` varchar(50) default NULL, `SSN` varchar(50) default NULL, `CRId` int(10) NOT NULL default '0', `Last` varchar(50) default NULL, `First` varchar(50) default NULL, `Middle` varchar(50) default NULL, `DOB` datetime default NULL, `PhaseID` int(10) NOT NULL default '0', `Dorm` varchar(50) default NULL, `Number` int(10) default NULL, `TJPC_PID` varchar(50) default NULL, `UserName` varchar(50) default NULL, `Computer` varchar(50) default NULL, `PO` varchar(75) NOT NULL, `ChargeType` int(10) unsigned default NULL, PRIMARY KEY USING BTREE (`CadetID`), KEY `CadetID` (`CadetID`) ) ENGINE=MyISAM AUTO_INCREMENT DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
What you are looking for is a combination of php/java/html. Add <META HTTP-EQUIV="refresh" CONTENT="15"> inside the <head></head> and then add a script in either php or java, whatever flavor you like, to get a timestamp, and run it thru a switch(). Or you can have just a random image from an array loaded. something like: <?php $Picture_array = array("image1.jpg","image2.jpg","image3.jpg","image4.jpg"); $Randomnumber= rand(1,4); $picture = $Picture_array[$Randomnumber]; ?> <html> <head> <meta http-eqiv="refresh" content = "60" > </head> <body> <image src="<?php echo $picture; ?>" width=180 height=180> </body> </html>
-
Probably need to move this post to the php section. But I still can not get it to check the $_POST["QTY_"...... correctly. I did change the second if else statement so that it is checking for an array or not. If if(isset($_POST["Qty_" . $Cats[]["Products"][]["Name"])) is false then return an error for that Product, and go to the next loop of the for($i=0;$i<=count($Cats[]["Products"])- 1; $i++). The output that I am getting is that $Request[] is being set and no quantity error is being reported, but an error of "Nothing Requested." if(isset($_POST["ReqstID"])) { $Cats = getCategories(); for($i = 0; $i <= count($Cats) - 1; $i++) { if(is_array($Cats[$i]["Products"])) { for($j = 0; $j <= count($Cats[$i]["Products"]) - 1; $j++) { if(isset($_POST["checkbox_" . $Cats[$i]["Products"][$j]["ProdID"] ])) { if(isset($_POST["Qty_" . $Cats[$i]["Products"][$j]["Name"] ])) { $Request[] = array("ID" => $Cats[$i]["Products"][$j]["ProdID"], "Name" => $Cats[$i]["Products"][$j]["Name"], "Qty" => $_POST["Qty_" . $Cats[$i]["Products"][$j]["Name"]]); $Form = 2; } else { $error = $error . " : " . "Missing Quantity for :" . $Cats[$i]["Products"][$j]["Name"]; $Form = 2; } } else { $Nothing = "Nothing"; } } if(isset($Nothing)) { $error = $error . " : " . "Nothing Requested."; $Form = 2; } } else { continue; } } } else { $Form = 1; }
-
I figured it out, needed to change the "break;" to a "continue;"
-
I am having a small problem with one of my "isset()" statements. Under "case 2", the third "if"statement, it will not goto the "else" part of the function. <?php include "InventoryFunctions.php"; include_once "StaffNameFunc.php"; include_once "MemberFunctions.php"; /* require_once "./login/settings.php"; include "MemberFunctions.php"; include "DailyLogFunctions.php"; checkLogin('1 2'); */ $error = Null; /* `Inventory`.`Request` `RequestID` int(10) NOT NULL auto_increment, `StaffID` int(10) default NULL, `DTGRequest` datetime default NULL, `DTGCreated` timestamp NOT NULL default CURRENT_TIMESTAMP, `User` varchar(50) default NULL, `Computer` varchar(50) default NULL, */ $StaffList = StaffList(); if(isset($_POST["Form"])) { $tForm = (int)$_POST["Form"]; $error = Null; switch($tForm) { case 1: if(isset($_POST["StaffName"]) and isset($_POST["Year"]) and isset($_POST["Month"]) and isset($_POST["Day"])) { if(strlen($_POST["Year"])>4) $error = $error . " : " . " Check Year Format, incorrect number of numbers. "; if(strlen($_POST["Month"])>2) $error = $error . " : " . " Check Month Format, incorrect number of numbers. "; if(strlen($_POST["Day"])>2) $error = $error . " : " . " Check Day Format, incorrect number of numbers. "; //$Time = strtotime($_POST["Time"]); $DTG = mktime(0,0,0,$_POST["Month"],$_POST["Day"],$_POST["Year"]); if(isset($error)) { $Form = 1; } else { $user = 3; $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); $Computer = $hostname . ":" . $_SERVER["REMOTE_ADDR"]; $ReqstID = startRequest($_POST["StaffName"],$DTG,$user,$Computer); $Form = 2; $Cats = getCategories(); } } else { $Form = 1; } break; case 2: if(isset($_POST["ReqstID"])) { $Cats = getCategories(); for($i = 0; $i <= count($Cats) - 1; $i++) { if(count($Cats[$i]["Products"])==1) { $i++; break; } else { for($j = 0; $j <= count($Cats[$i]["Products"]) - 1; $j++) { if(isset($_POST["checkbox_" . $Cats[$i]["Products"][$j]["ProdID"] ])) { if(isset($_POST["Qty_" . $Cats[$i]["Products"][$j]["Name"] ])) { $Request[] = array("ID" => $Cats[$i]["Products"][$j]["ProdID"], "Name" => $Cats[$i]["Products"][$j]["Name"], "Qty" => $_POST["Qty_" . $Cats[$i]["Products"][$j]["Name"]]); $Form = 2; } else { $error = $error . " : " . "Missing Quantity for :" . $Cats[$i]["Products"][$j]["Name"]; $Form = 2; } } else { $Form = 2; } } } } } else { $Form = 1; } break; } } else { $Form = 1; } ?> <html> <head> <link rel=stylesheet type="text/css" href="./themes/theme.css"> <title>Hidalgo County Juvenile Boot Camp Intranet Access</title> </head> <body> <?php if(isset($error)){ echo "\n<p>" . $error . "</p>\n";} ?> <form class="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="Form" value="<?php echo $Form; ?>" > <input type="hidden" name="ReqstID" value="<?php echo isset($ReqstID)?$ReqstID:Null;?>"> <?php switch($Form) { case 1: ?> <table width = 40% align = center> <tr> <th colspan = 3> Date of Request </th> </tr> <tr> <td width = 33%> <label for="Year">Year</label> <input type="text" name="Year" size=4 value="<?php echo (isset($_POST["Year"])?$_POST["Year"]: date("Y"));?>" > <br>#### </td> <td width = 33%> <label for="Month">Month</label> <input type="text" name="Month" size=2 value="<?php echo (isset($_POST["Month"])?$_POST["Month"]: date("m"));?>" > <br>## </td> <td width = 33%> <label for="Day">Day</label> <input type="text" name="Day" size=2 value="<?php echo (isset($_POST["Day"])?$_POST["Day"]: date("d"));?>" > <br>## </td> </tr> </table> <select name="StaffName" value="<?php echo (isset($_POST["StaffName"])? $_POST["StaffName"] : "") ?>" > <?php for($i=0; $i<=count($StaffList)-1; $i++) { ?> <option value="<?php echo $StaffList[$i]["StaffID"]; ?>"<?php if(isset($_POST["StaffName"])) echo (($_POST["StaffName"]==$StaffList[$i]["StaffID"])? "selected" : ""); ?> > <?php echo $StaffList[$i]["StaffName"]; ?></option> <? } ?> </select> <br> <input type="submit" name="submit" value="submit"> <? break; case 2: for($i = 0; $i <= count($Cats) - 1; $i++) { if(count($Cats[$i]["Products"])==1) { ?> <table width = 100% align = center> <tr> <th colspan=1><?php echo $Cats[$i]["Category"]; ?></td> </tr> <tr> <td width = 100% align = center><?php echo "\n". $Cats[$i]["Products"];?></td> </td> </table> <br><hr><br> <? } else { ?> <table width = 100% align = center> <tr> <th colspan = 5><?php echo $Cats[$i]["Category"]; ?></th> </tr> <tr> <td width = 10%><br></td> <td width = 15%>Product Name</td> <td width = 10%>Size of Product</td> <td width = 10%>Shipment Size</td> <td width = 15%>Quantity of Shipment Size</td> </tr> <? for($j = 0; $j <= count($Cats[$i]["Products"]) - 1; $j++) { ?> <tr> <td width = 5%> <input type="checkbox" name="checkbox_<?php echo $Cats[$i]['Products'][$j]['ProdID']; ?>" > </td> <td width = 15%><?php echo $Cats[$i]["Products"][$j]["Name"]; ?></td> <td width = 10%><?php echo $Cats[$i]["Products"][$j]["Size"];?></td> <td width = 10%><?php echo $Cats[$i]["Products"][$j]["ShipSize"]?></td> <td width = 15%><input type="text" name="Qty_<?php echo $Cats[$i]["Products"][$j]["Name"]; ?> " size=4 value="" ></td> </tr> <? } ?> </table> <br><hr><br> <? } } ?> <input type="submit" name="submit" value="submit"> <? if(isset($Request)) print_r($Request); break; } ?> </form> </body> </html>
-
On my intranet site I use frames to display a multitude of data from my databases depending upon which subject is requested, ie Employee information and status, Company info and status, .... this list goes on...... I am trying to get away from MS Access for my front end and go completely webbased, and I want the employees to log on to the intranet to be able to write/edit/view the information. So, in my login script, when verified to login, I want to be able to redirect to the "member" page in a new window. But, after looking into some other options, which I should have done before, I think that I will redirect the employees to a SSL page in a new window.
-
I use frames in my intranet site. Is there a way to send a header (Location: ....) to a new window? This is for my authentication scripts and to change between unrestricted and restricted locations.
-
Try this, it works for me great: <?php error_reporting(E_ALL); // To report any errors that happen Comment out when finished with coding $Query = "Select ....."; $QueryResults = mysql_query($query, $link) or die("\n Could not run Query : " . $Query . " : " . mysql_error()); if(mysql_num_rows($QueryResults) == 0) { // run some code here } else { while($QueryRow = msyql_fetch_array($QueryResults, MYSQL_ASSOC)) { // run some code here } } ?>
-
I am trying to figure out whether having a multi-dimensional array ( 4 levels ) is "better" than to have a complex while{mysql_fetch_array} : a. Speed b. Size c. coding the output d. which way to code the array /* $Year = PRTYear(); $Month = for loop running the 1 - 12 $TypeID = PRTType(); */ // Array 1 $PRT[$Year][$Month][$TypeID] = PRTTypeCountperMonth($Year,$Month,$Type); // Array 2 $PRT[] = array("Year" => $Year, "Month" => $Month, "Type" => $Type, "Count" => PRTTypeCountperMonth($Year, $Month, $Type)); // Array 3 $PRT[] = array($Year => array ($Month => array($Type => PRTTypeCountperMonth($Year, $Month, $Type))); or while($Year) // shortened mysql statements { echo "\n" . $Year; while($Month) { echo "\n" . $Month; while($Type) { echo "\n" . $Type . " Count : " . $Count; } } }