-
Posts
738 -
Joined
-
Last visited
Posts posted by SkyRanger
-
-
I am trying to figure out how to add hours to my countdown time:
$months = floor($difference / 60 / 60 / 24 / 30); $days = ($difference / 60 / 60 / 24) % 30; $hours = ($difference ?;
-
Awesome guys, thank you, never used floor before that is probably when I could not figure it out. Learn something new every day.
-
Almost but I am getting the output of:
1.7996091821 months, 0 days until Christmas
-
I am trying to convert the output to month days:
$sql = "SELECT * FROM ".$prefix."_holiday_countdown"; $result = $db->sql_query($sql); while ( $row = $db->sql_fetchrow($result) ) { $hmonth = $row['hmonth']; $hday = $row['hday']; $hyear = $row['hyear']; $holiday = $row['hholiday']; } $target = mktime(0, 0, 0, $hmonth, $hday, $hyear) ; $today = time () ; $difference =($target-$today) ; $days =(int) ($difference/86400) ; $content = " $days till ".$holiday;
I am trying to figure out how to get it to convert to ? months ? days till $holiday
-
D'oh, Nevermind, found it stupid me forgot to add a } at the end, works now, thanks guys.
-
lol, yeah, I caught the ++$i but trying to find the other error, Thanks for your help so far, it is greatly appreciated.
-
Ok, Guess I missed something:
$sql = "SELECT * FROM ".$prefix."_bus_monitor"; $result = $db->sql_query($sql); $arrNotRunning = array(); while ( $row = $db->sql_fetchrow($result) ) { if(strcasecmp($row['brun'], 'running') != 0){ $arrNotRunning['status'][] = $row['brun']; $arrNotRunning['school'][] = $row['bschool']; } if(count($arrNotRunning) == 0) { $content = "All buses running normally.<br />"; } else { $content = "The following buses are delayed or canceled: <br />"; $loopCount = count($arrNotRunning['status']); for($i = 0; $i < $loopCount; $++i){ $content .= "Bus ".$i.": ".$arrNotRunning['school'][$i]." ".$arrNotRunning['status'][$i]."<br/>"; }
-
Sorry double posted
-
This is what I ended up with:
The following buses are delayed or canceled:
Bus 1: Array
Bus 2: Array
I may have to try and go the other route and try to coordinate the arrays
-
This is what I ended up with:
The following buses are delayed or canceled:
Bus 1: Array
Bus 2: Array
I may have to try and coordinate the arrays for their output.
-
Well I thought I had it, sorry for being a pain guys. I am also trying to get some more data to output with the delayed/canceled status.
What I am trying to get is:
Bus no 1: School Name Delayed
Bus no 2: School Name Canceled
etc.
I can get the school name to display but for some reason, it is only displaying 1 school name for all entries.
I tried a number of different things, and so far...all wrong...lol
$arrNotRunning = array(); while ( $row = $db->sql_fetchrow($result) ) { if(strcasecmp($row['brun'], 'running') != 0) $arrNotRunning[] = $row['brun']; $bschool = $row['bschool']; } if(count($arrNotRunning) == 0) { $content = "All buses running normally.<br />"; } else { $content = "The following buses are delayed or canceled: <br />"; $intBus = = 1; foreach($arrNotRunning as $strBusStatus){ $content .= "Bus ".$intBus.": ".$bschool." ".$strBusStatus."<br/>"; $intBus++; } } ?>
-
Woohoo, it worked, thanks. That is 1/2 of my code done, Now just to get the rest of the mysql data to output. Thanks guys for all of your help.
-
Almost, not it is showing the opposite to what I need:
The following buses are delayed or canceled: Bus No: 1: Running Bus No: 2: Running Bus No: 3: Running Bus No: 4: Running
-
The following buses are delayed or canceled: Bus No: 1: Running Bus No: 2: Delayed Bus No: 3: Cancelled Bus No: 4: Running Bus No: 5: Running Bus No: 6: Running
-
Almost got it, but I only need it to show the buses that are canceled and/or delayed.
-
~bump~
-
$sql = "SELECT * FROM ".$prefix."_bus_monitor"; $result = $db->sql_query($sql); while ( $row = $db->sql_fetchrow($result) ) { $busstatus = $row['brun']; }
So what I am trying to do is get it to say if no buses are delayed then post:
All buses running normally.
But if there are a buses delayed or canceled like in the example above:
bus 2 - delayed
bus 5 - canceled
-
I am having a small problem I am trying to pull info from my database when something changes.
Example 1:
$busstatus = $bstat; if ($busstatus = "running) echo "All buses are running"; else echo "The following buses are delayed or canceled";
In the database I would have:
bus 1 - running
bus 2 - running
bus 3 - running
bus 4 - running
bus 5 - running
So if all the buses are running it would say "All buses running"
but if one of them got changed:
bus 1 - running
bus 2 - delayed
bus 3 - running
bus 4 - running
bus 5 - canceled
I am trying to get the else statement to say:
The following buses are delayed or canceled
-
Thanks guys
-
Is there a way to strip certain code.
I have something like: This_is_the_name
I would like it to out put as: This is the name
Would I use strip_tags for that or something else?
-
D'oh, thanks
-
Not sure if this is possible. In my database I have A list of schools and the towns they are in.
Example:
School 1 town 1
School 2 town 1
school 3 town 2
school 4 town 2
school 5 town 1
I can get it to display just as I have it above, I was wondering if there was a way that I can do:
town 1
-------
School 1
School 2
School 5
town 2
-------
school 3
school 4
-
After rewriting the code once again, I finally figured it out.
if (isset($_POST[submit])) { foreach ($_POST as $key) { $id=$key[id]; $mid=$key[mid]; include "../inc/dbconnect.inc.php"; mysql_query("UPDATE menu set mid = '$mid' where id = '$id'") or die(mysql_error());; } } ........... connect code for DB + rest of form............. ........... while($rows=mysql_fetch_array($result)){ $id = $rows['id']; $mid = $rows['mid']; ?> <tr> <td align="center"><? echo $rows['id']; ?></td> <?php print "<input type='hidden' name =".$id."[id] value =".$id.">"; ?> <td align="center"><?php echo "<input type='text' size='2' name=\"".$id."[mid]\" value=".$mid.">"; ?> </td> <td align="center"><? echo $rows['msect']; ?></td> <td align="center"><? echo $rows['mtialt']; ?></td> <td align="center"><? echo $rows['mpgim']; ?></td> </tr> <?php } .......+ rest of form
-
[SOLVED] Show hours in countdown
in PHP Coding Help
Posted
Nevermind, figured it out.