PHP - How Do I Echo Year Headers On Schedule?
I've got a class schedule that spans two years and I would like to have the years as headers. startDate is unix date field.
Here is existing code: $sql = "SELECT * FROM classOfferings, classes, instructors WHERE classes.classId = classOfferings.classId AND classOfferings.instructorId = instructors.instructorId AND classOfferings.startDate >= CURDATE() ORDER BY classOfferings.startDate"; if(! $retval ) { die('Could not get schedule: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "{$row['dates']}"; if ($row['hours'] != 0){ echo "</td> "; } else { echo "CANCELLED</td>"; } echo "<td class='cell2'>". "<a href='classDetail.php?seq={$row['seq']}'>{$row['title']}</a>". "{$row['days']}". "{$row['times']}". "<a href='instructorDetail.php?instructorId={$row['instructorId']}'>{$row['fName']} "." ". "{$row['lName']}</a></td>} echo "</td></tr></table></div>"; } Similar TutorialsHello, i have two fields. a beginning year and an ending year. How can i make new fields out of the years in between the beginning and ending years. i hope that makes sense. I currently have the below code that reads a database to find what time a staff member is scheduled for work and what day. The below code works fine however on the same day it print lets say they work more then one hour it would show Sunday 2a - 3a, Sunday 3a - 4a, Sunday 4a - 5a ..... and so on I would just like it to simply put Sunday 2a - 5a skipping the extra output. $dayname = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); $shifts = array(); $num=0; $days=0; for ($d = 0; $d <= 6; $d++) { $slot = mysql_fetch_array(mysql_query("SELECT * FROM rp_timetable WHERE day = '$dayname[$d]'")); for ($i = 1; $i <= 24; $i++) { $ap1 = "a"; $ap2 = "a"; if ($slot["$i"] == $eusername) { $one = $i-1; if($one >= 12) { $one = $i-13; if($one == 0) { $one = 12; } $ap1 = "p"; } $two = $i; if($two >= 12) { $two = $i-12; if($two == 0) { $two = 12; } $ap2 = "p"; } $shifts[$num] .= $dayname[$d].' '.$one.''.$ap1.' - '.$two.''.$ap2.' EST<br>'; $num++;}} } if($shifts[0] != NULL){ echo"<table><tr><td><strong>Air Shifts:</strong></td><td>"; for ($i = 0; $i <= $num; $i++) { if($i == 0) {echo $shifts[$i].'</td></tr>';} else {echo '<tr><td></td><td>'.$shifts[$i].'</td></tr>';} }} print"</table>"; Hi, This may be the wrong way to do things but I am fairly new to this. I have a mysql database which I store some jobs I run. I usually use schedule tasks for this but was wondering if I could do this more efficiently in PHP. I have a table with days of the week comma seperated and then a column with a time and then a column with the name of the job. I basically need something to kick off a job at a given time on a certain day. If someone can point me in the right direction it would be appreciated and I can usually crack on from there Hi everyone I need some help on how to go about designing a script for a high school. It is for teachers so that they can book periods for the computer lab, studio etc. I want it so when they go to the page it has this week with all the slots taken. What I'm having trouble with is I want them to also be able to go to any date they wish and bring up that weeks schedule because they need to be able to book in advance. Would anyone be able to explain a technique on how I can go about this Thanks in advance I am trying to write a simple method of displaying our meetings schedule for North Idaho Area Narcotics Anonymous it pulls from a MySQL database and I want it to look like this: COEUR D'ALENE Sunday: Group 1 Name Time Group 2 Name Time Group 3 Name Time Monday: Group 1 Name Time Group 2 Name Time POST FALLS Sunday: Group 1 Name Time Ok so my problem is I dont know how to make php create the heading only if there are meetings in that heading so if there are no meetings in POST FALLS then it wont make a list for post falls or if there are no meetings in POST FALLS on Sunday then it wont show the SUNDAY heading. This way it will be maintenance free page just add/delete meetings in the database then go from there. Each meeting name will be a link to an ID corresponding to the unique ID in the database so you click it then read all the info on that meeting. It will be a way for NA members to view the schedule from their mobile phones easily. I have written loops but nothing that would leave out a heading based on lack of a given entry. Any help would be most appreciated. Thank you!!! Chad I'm new here so I say hallo to everyone I have to implement bus time table in this way: Every bus drives every second day from the day chosen. Let's say: If xx bus goes every second day from 23rd February to 30th June to Spain (23rd, 25th, 27th...), How can I check if let's say on 14th May there is bus to Spain? I started with odd and even numbers: if it starts from the even day than there is array of months with number of days, but what if Feb has 29days (every 4th year) instead of 28... I'm totally confused here. In database I have rows: start date, end date and bus name. Is there any other way of implementing this? I need help to get flight schedule from http://www.sriwijayaair.co.id/id but always error using curl to access ssl. here are my code: <?php $headers = array( "User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB7.1 (.NET CLR 3.5.30729)", "Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language=en-us,en;q=0.5", "Accept-Encoding=gzip,deflate", "Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive=1150", "Connection=keep-alive", "Referer=http://www.sriwijayaair.co.id/id", "Cookie=language=in; location=id; dest=home; __utma=260465999.1394002812.1293106375.1293106375.1293106375.1; __utmb=260465999.1.10.1293106375; __utmc=260465999; __utmz=260465999.1293106375.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)", "Content-Type=application/x-www-form-urlencoded", "Content-Length=121", "POSTDATA=isReturn=false&from=CGK&to=MES&departDate1=30-&departDate2=11-2010&adult=1&child=0&infant=0&returndaterange=0&Submit=Cari" ); // do access to sriwijaya air $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://booking.sriwijayaair.co.id/b2c/AvailabilityServlet"); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_COOKIEJAR, "cookie.txt"); //curl_setopt($curl, CURLOPT_POSTFIELDS, "isReturn=false&from=CGK&to=MES&departDate1=22&departDate2=01-2011&adult=1&child=0&infant=0&returndaterange=0&Submit=Cari"); $curlData = curl_exec($curl); print_r($curlData); curl_close($curl); ?> any help will be appreciate, thanks This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=342882.0 hello guys. i need to run a script automatically at scheduled date and time. i am sending bulk emails . i need to setup an email campaign, in such a way that i can schedule like daily, monthly or quarterly.. can u guys give few tips to get it done.. I have database "raj" with table "pagination"
In table pagination have "id", "actualtime" and "created" field
id - auto_increment actualtime- varchar created- datetime
that looks like this CREATE TABLE pagination( id int auto_increment, actualtime varchar(55), created datetime )
I want to display all rows which are created on todays date and will display from today upto yesterday at 06:00 pm. after that the content will be refreshed based on based on a DATETIME field called 'created' that holds the date and time of each record's creation.
this is my query to fetch rows but it display value after 06:00 pm on yesterday but i want to display all data before 06:00 pm from currentdate. After 06:00 pm data will be refreshed and clear. plz help me......
SELECT actualtime FROM pagination WHERE created BETWEEN date_add(date_sub(curdate(), INTERVAL 1 day), INTERVAL 18 hour) AND curdate()";
Hi there, I am working on a php project on my WAMP server where I have access to XML datafeed from xe.com once a day to get the Exchange rates. This xml datafeed is saved on my localhost as an archived copy. Now I would like to automatically access the fresh xml datafeed file from xe.com once a day and replace (or update) the xml file on my localhost to have the updated information (rates). How can I schedule this task automatically and make php access the updated xml file once a day. All comments and feedbacks are always welcomed Thank you! Hi Folks, I'm creating an equipment reservation system for a client. Every reservation has an equipmentID, ReservationDate, StartTime, EndTime. So, basically my script searches existing records for a given date and EquipmentID. I'm having trouble with how best to approach validation on new reservations to ensure there are no conflicts. Lets say two existing reservations for a given date/equipment are found. One reservation has a startTime of 8AM and endTime of 9AM. The second has a startTime of 12PM and endTime of 3PM. Is there a simple way to check if the user's submitted values for StartTime and EndTime conflict with existing reservations? Any input would be greatly appreciated! Thanks! -John Hi all, I am wondering what the best way to do this is... Take GoDaddy for example, if your domain is about to expire you will get an automatic email. I am wanting to do something similar, If someone orders a Soap Dispenser, I want to send an email (if they accept to receiving emails on the order) each month asking/reminding them to top up on soap. I have been reading but cant find anything adequate, I have seen something about Cron Jobs, but never heard of this before, please could you point me in the right direction. Thanks in advance. Peter OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> Hi All, I'm trying to echo the response from an SLA query, the query works and returns the data when I test it on an SQL application.. but when I run it on my webpage it won't echo the result. Please help? <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $sql = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1'"; $result = mysqli_query($mysqli, $sql); echo {$result['message']}; ?> Why does this work: $dateAllowedSelect = date('Y') -18; But this doesn't: $dateAllowedSelect = date('Y') +5; I nee to get the current year plus 2010 - 2015 in a select box. Thank you. I need help with a query.
I've got a table that stores references to calls that come in to our office. It has a datetime field, and for the purposes of the query, it's the only thing in this table that is important.
I've got another table that stores appointment information. The appointment start time is also a datetime field. For this query, this start time is the only thing in this table that is important.
I need to know how many times in the last year there was a day when we had at least 150 calls come in and made at least 1 appointment.
SELECT COUNT(*) FROM appointments a LEFT JOIN ( SELECT DATE(time) FROM calls WHERE <there are at least 150 calls on a day> ) c ON DATE(a.start_time) = c.time WHERE a.start_time >= CURDATE() - INTERVAL 1 YEARTo make things difficult, I guess the time would have to be converted to a day, because I'm looking for all days where there was an appointment, and the datetime field is too specific. I've been looking online for 30 mins or so, and was hoping somebody here could point me in the right direction. I'm not making much progress by myself. Edited by sKunKbad, 06 October 2014 - 01:17 PM. So I have decided to do research as my project and gain something from this. But also I will have to include programming which i prefer PHP. and will be testing these for my research. Does this sound like a good project and also If it is good sound.. Where do I start?... need a starting point and then I could go on to doing it.. Gud Pm! Im trying to display a list of years (last year, current year and next year) with these simple code i made.. It displays the current and next year correctly except last year, which gives me "1970". I don't get why it gives me that since may next year works properly.. Code: [Select] $currentyear = date('Y'); $subtract_year = strtotime(date('Y', strtotime($currentyear)) . '-1 year'); $lastyear = date('Y', $subtract_year); $addyear = strtotime(date('Y', strtotime($currentyear)) . '+1 year'); $newyear = date('Y', $addyear); $year_array = array($lastyear, $currentyear, $newyear); foreach($year_array as $year) { echo "<option value='{$year}'>"; echo $year; echo "</option>"; } I'm not familiar with dates yet.. so i'm gonna read the manual while w8ting for your kind replies. |