PHP - Display Events Under Specified Month....
Ok, so I have made 12 columns in mysql for each month.........I will have an event manager page that you can select each month that the event will take place in 0 is false 1 is true.........so I need to know how I can edit this code so that if the current month equals whatever month is checked, it will display..........is there a way to do this????????or would I need to use a date format instead of varchar and use a format such as yyyy-mm-dd and value = 0000/mm/00 so that only the month will display and then it could equal current month? Code: [Select]
<?php // if no id is specified, list the available articles if(!isset($_GET['eventid'])) { $query = "SELECT eventid, event, startdate, enddate FROM Registration ORDER BY eventid"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($eventid, $event, $startdate, $enddate) = $row; $as .= "<p><a href=\"viewevent.php?eventid=$eventid\">$startdate - $enddate --- $event</a></p>\r\n"; } $Events = 'Events'; } else { // get the article info from database $query = "SELECT event, description, startdate, enddate, location, subevent1, subevent2, subevent3, subevent4, subevent5, subevent6, subevent7, subevent8, price1, price2, price3, price4, price5, price6, price7, price8 FROM Registration WHERE eventid=".$_GET['eventid']; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $startdate = $row['startdate']; $enddate = $row['enddate']; $location = $row['location']; $description = $row['description']; $event= $row["event"]; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; } ?> Code: [Select] <table width="410" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="339" bgcolor="#999999" scope="col">EVENTS</td> </tr> <tr> <td class="afasd"><?php echo date("F",strtotime("-0 month")); ?></td> </tr> <tr> <td><?php echo $as; ?></td> </tr> <tr> <td class="adfaf"><?php echo date("F",strtotime("+1 month")); ?></td> </tr> <tr> <td><?php echo $as; ?></td> </tr> <tr> <td class="jasdfjs"><?php echo date("F",strtotime("+2 month")); ?></td> </tr> <tr> <td><?php echo $as; ?></td> </tr> </table> does this make sense? Similar TutorialsHi guys, Im having problem on how to achieved this one.. I would like to get the all event of this month (April ) Starting todays date.. Code: (php) [Select] $now = gmdate("Y-m-d", mktime(gmdate("H")+8, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d")+8, gmdate("Y"))); $week = gmdate("Y-m-d", mktime(gmdate("H")+8, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d")+30, gmdate("Y"))); if ($result = mysql_query("SELECT * FROM fiesta WHERE sta_date BETWEEN '$now' AND '$week' ORDER BY sta_date LIMIT 10")){ if (mysql_num_rows($result)) { $return = ''; while ($row = mysql_fetch_array( $result )) { $date = date("D",strtotime($row["sta_date"])); $return .= "<a href='sta.php' style='font-size:11px;' title='" . $row['fiesta_brgy'] . " " . $row['fiesta_town'] . "'>" . $row['fiesta_brgy'] . " " . $row['fiesta_town'] . "</a> ($date), "; } echo rtrim($return, ', '); } } The result of this query will include the events on May.. How can i display only the event on this month(April)? starting todays date. Thank you Hi,
I want to display my data in this format
format.JPG 54.52KB
0 downloads
Expense data i am getting like this
<td><?php $in = "SELECT sales_invoice.invoice_id as INID, DATE_FORMAT(sales_invoice.date_invoiced,'%M') AS month, sales_invoice_line_items.invoice_id, SUM(sales_invoice_line_items.sub_total) AS Total, SUM(sales_invoice_line_items.tax_amount) AS total_tax FROM sales_invoice INNER JOIN sales_invoice_line_items ON sales_invoice.invoice_id=sales_invoice_line_items.invoice_id GROUP BY sales_invoice.invoice_id, DATE_FORMAT(sales_invoice.date_invoiced, '%Y-%m')"; $in1 = mysql_query($in) or die (mysql_error()); $total=0; $tax =0; while($income = mysql_fetch_array($in1)) { $total +=$income['Total']; $tax +=$income['total_tax']; echo $total - $tax; } ?> </td>And Profit i am getting like this <td><?php $in = "SELECT purchase_invoice.invoice_id as INID, DATE_FORMAT(purchase_invoice.date_invoiced,'%M') AS month, purchase_invoice_line_items.invoice_id, SUM(purchase_invoice_line_items.sub_total) AS Total, SUM(purchase_invoice_line_items.tax_amount) AS total_tax FROM purchase_invoice INNER JOIN purchase_invoice_line_items ON purchase_invoice.invoice_id=purchase_invoice_line_items.invoice_id GROUP BY purchase_invoice.invoice_id, DATE_FORMAT(purchase_invoice.date_invoiced, '%Y-%m')"; $in1 = mysql_query($in) or die (mysql_error()); $total=0; $tax =0; while($income = mysql_fetch_array($in1)) { $total +=$income['Total']; $tax +=$income['total_tax']; echo $total - $tax; } ?> </td>I dont know how to display data like this. Do i need to change the the table structure in my database? Please suggest Hello ,
I am trying to display my planned events in calendar using full calendar json, jquery. But its not getting displayed, but its getting inserted. I am not very good at jquery or json. please somebody help me in this...
here is my code
in my calendar.php (display page)
<div class="span8"> <div class="w-box w-box-green"> <div class="w-box-header"></div> <div class="w-box-content"> <div id='calendar_json'></div> </div> <div class="w-box-footer"> <p class="f-text">JSON events fetched from a script</p> </div> </div> </div> </div>and in my calendar.js jsonEvents: function() { if($('#calendar_json').length) { $('#calendar_json').fullCalendar({ header: { left: 'month,agendaWeek,agendaDay', center: 'title', right: 'prev,next' }, buttonText: { prev: '<i class="icon-chevron-left icon-white cal_prev" />', next: '<i class="icon-chevron-right icon-white cal_next" />' }, editable: true, firstDay: 1, // 0 - Sunday, 1 - Monday events: "php_helpers/json-events.php", eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)'); } }); }json-events.php include("connect.php"); $year = date('Y'); $month = date('m'); //$db=public_db_connect(); $year = date('Y'); $month = date('m'); $command = "SELECT * FROM planner"; $result = mysql_query($command) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { echo "hi"; //$start = date("D, j M Y G:i:s T", strtotime($row['start'])); //$end = date("D, j M Y G:i:s T", strtotime($row['end_time'])); $start = date("Y-m-d", strtotime($row['from_time'])); //$start = "$year-$month-20"; $myid = $row['plan_id']; $eventsArray['plan_id'] = (int)trim($myid); //$eventsArray['title'] = $row['title']; $title = $row['company']; //$title = $row['title']; //echo $title; $eventsArray['company'] = $title; $eventsArray['from_time'] = $start; $eventsArray['to_time'] = $start; $eventsArray['url'] = "edit_calendar.php?calendarid=".$row['plan_id']; // $eventsArray['end'] = $end; // $eventsArray['allDay'] = false; $events[] = $eventsArray; } echo json_encode($events); I am a little confused with the difference between Symfony Events and Event Listners and Doctrine Events. The Doctrine events look pretty straight forward and are primary used for entity persistence, and I have outlined my understanding below: Doctrine Lifecycle Callbacks. Single entity and single Doctrine event. Method in class. Good performance. Don't have access to Symfony services (all others do) Doctrine Lifecycle Listeners. All entities and single Doctrine event. Separate class and configured in config.service.yaml. Doctrine Entity Listeners. Single entities and single Doctrine event. Separate class and configured in config.service.yaml. Doctrine Lifecycle Subscribers. All entities and multiple Doctrine event. Must implement EventSubscriber (or probably EventSubscriberInterface) Separate class and configured in config.service.yaml.I am more confused with the Symfony events and my interpretation as listed below is likely incorrect. Symfony Event Listeners. Single Symfony event. Separate class and configured in config.service.yaml. More flexible because bundles can enable or disable each of them conditionally depending on some configuration value. Symfony Event Subscribers. All specified Symfony events. Must implement EventSubscriberInterface Separate class but NOT configured in config.service.yaml but in class. Easier to reuse because the knowledge of the events is kept in the class rather than in the service definition.Are they used for totally different purposes or can one use Symfony events to also deal with entities? Where would one want to use these Symfony events? Is there a reason why Doctrine Lifecycle Subscribers are located in src/EventListener and not src/EventSubscriber Are Doctrine Lifecycle and Entity Listeners really only for a single event as I interpret the documentation states, or is it one method per Doctrine event such as the following? App\EventListener\SearchIndexer: tags: - name: 'doctrine.event_listener' event: 'postPersist' - name: 'doctrine.event_listener' event: 'postUpdate'
Trying to get the below to generate the month in word form from a numeric entry in a database. Code: [Select] elseif($_GET['rma']=="calander"){ $sql101010="SELECT DISTINCT rma_year_issued FROM $tbl_name4 ORDER BY rma_year_issued"; $result101010=mysql_query($sql101010); while($row101010=mysql_fetch_array($result101010)){ extract($row101010); $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'">'.$rma_year_issued.'</a> <br />'; } if(isset($_GET['year'])){ $logout.=' | <a href="./acp_admincp.php?rma=calander">Back to RMA Calander</a>'; $rma_year_issued=$_GET['year']; $sql111010="SELECT DISTINCT rma_month_issued FROM $tbl_name4 WHERE rma_year_issued='$rma_year_issued' ORDER BY rma_month_issued"; $result111010=mysql_query($sql111010); while($row111010=mysql_fetch_array($result111010)){ extract($row111010); $months = array('Janurary', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); for($i=0; $i <=11; $i++){ if($rma_month_issued=$i){ $rma_month_issued2=$months[$i]; } } $content=""; $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'&month='.$rma_month_issued.'">'.$rma_month_issued2.'</a> <br />'; } } } Basically in the data base I may have 2,5,7 under the year 2011. I want to get the numeric months into words for use in the text of the link. The above is returning December even though the entry in the database is 5. Hi.. I need help in getting the 3 Months Name from my table field FromMonth and ToMonth. Here is the scenario. First, I select FromMonth and ToMonth. Ex. FromMonth = 5 ToMonth = 7 So it means FromMonth is May ToMonth is July. Now I save the MonthNumber to my database: table- so_month FromMonth = 5 ToMonth = 7 Now I need to get the between Months Name from FromMonth to ToMonth which are (May, June, July). How does it possible? Thank you so much. So I am creating a list of events. There will be a drop down menu to change between months. I only want the months to be listed if an event during that month exists. So if I have events listed for September and November, list only September and November, skipping October. Any idea on how to approach this or if there are any functions for such a thing? Hello. I want to generate the initial of the day of all the days of a chosen month. Meaning, if I choose this month it will give me: TFSSMTWTFSSMTWTFSSMTWTFSSMTWTF Is that clear? Can anybody help me? thanks! Hi, this one has me stumped! For some reason February refuses to show up in my calender, that is, month 2 reads as march as well as month 3 (being correct). Here is my code which is fine except for this silly bug: $month = $_GET['month'] ; $year = $_GET['year'] ; if(!$month) $month = date('n') ; if(!$year) $year = date('Y') ; $days = cal_days_in_month(CAL_GREGORIAN, $month, $year) ; echo "<div style='width:100%;text-align:center;font-size:1.3em;font-weight:bold;'>" ; if($month == 1) echo "<a href=\"?month=12&year=" . ($year-1) ; else echo " <a href=\"?month=" . ($month-1) . "&year=" . $year ; echo "\"><img style='border:none;' width='16' src='prev-month.png' /></a>" ; echo " Classes for " . date("F, Y", strtotime("$year-$month")) . "\n" ; if($month == 12) echo "<a href=\"?month=1&year=" . ($year+1) ; else echo " <a href=\"?month=" . ($month+1) . "&year=" . $year ; echo "\"><img style='border:none;' width='16' src='next-month.png' /></a>\n" ; echo "</div>\n" ; for($i=1;$i < 8;$i++) { // Create day headers... echo "<div style='float:left;width:110px;margin:20px 5px 0px 5px;text-align:center;background:#1552ff;color:white;border:1px solid #155BFF;'>" . date("l", strtotime("$year-$month-$i")) . "</div>\n" ; } for($i=1; $i < $days+1;$i++) { // Create days... $result = mysql_query("SELECT * FROM classes WHERE DAY(classDate) = '$i' AND MONTH(classDate) = '$month' AND YEAR(classDate) = '$year'")or die(mysql_error()) ; $classCount = mysql_num_rows($result) ; while($row = mysql_fetch_assoc($result)) { $classes .= $row['title'] . "<br />" ; } echo "<div style='float:left;width:104px;height:104px;margin:0px 5px 0px 5px; border:1px solid #155BFF;border-top:none;cursor:pointer;padding:3px;' onmouseover=\"this.style.background='#ffbdec';\" onmouseout=\"this.style.background='none';\" title=\"" . str_replace('<br />', "\n\n", $classes) . "\" alt=\"" . str_replace('<br />', "\n\n", $classes) . "\">\n" ; echo "<div style='float:left;height:84px;width:104px;'>\n" ; echo "<span style='font-weight:bold;'>$i</span><br />\n" ; echo "<span style='font-size:0.7em;'>" ; echo $classes ; echo "</span></div>\n" ; echo "<div style='float:left;height:20px;width:104px;text-align:center;'>\n" ; echo "<a href='#' style='font-size:0.7em;'>click to book a class</a>\n" ; echo "</div>\n" ; echo "</div>\n" ; $classes = '' ; } working example he www.caketopper.co.uk/2011/class-schedule.php Hi, I m trying to extract data by month from my date table. my date format 2011-03-28 my query $sql = "select * from table WHERE MONTH(date) = 03 " Now problem is i have many records in 3rd month but it only display the first row with above $sql. How can i see all month records. Thanks OK, since today is the 31st, I guess I figured out that strtotime("-1 Month') really only goes back 30 days, so where I think it should be September, its registering October 1st. Is there a fix for this? Code: [Select] $month = date('F Y', strtotime("-1 month")); $month1 = date('F Y', strtotime("-2 month")); $month2 = date('F Y', strtotime("-3 month")); $month3 = date('F Y', strtotime("-4 month")); $month4 = date('F Y', strtotime("-5 month")); $month5 = date('F Y', strtotime("-6 month")); I need to find the last Friday of each month and determine the start and end dates of each month based on the last Friday. So, for September, the last Friday was the 27th, that means Saturday the 28th will be the last day of September. September 29 will then start the first day of October.... October 25 is the last Friday in October, so Saturday October 26 will close out October..... Sun Oct 27 starts November, etc... 7/28 - 8/31 9/1 - 9/28 9/29 - 10/26 10/27 - 11/30 I can build a table and manually key in the start and end dates then query as needed, but if there is a way to do it on the fly, I'd rather do it in php to eliminate mistakes.
Below is the code I'm currently using to find the first and last day of each calendar month, but I'll need to convert this to find the fiscal month based on the last Saturday of each month. And go back a few years in the option select. <select name="dateselect" id="dateselect"> <?php $today = date("Y-m-d"); $monthbegin = date("Y-m-d",strtotime('first day of this month', strtotime($today))); for( $i= 0 ; $i <= 52 ; $i++ ) { if($i == 0){ $monthselect = date('Y-m-d',strtotime($monthbegin)); $monthdisplay = date('F Y',strtotime($monthbegin)); echo '<option ' . ($i == 0 ? 'selected=\'selected\'' : '') . ' value="' . $monthselect . '" >' . $monthdisplay . '</option>'; } else{ $monthselect = date('Y-m-d',strtotime('-'."$i".' months',strtotime($monthbegin))); $monthdisplay = date('F Y',strtotime('-'."$i".' months',strtotime($monthbegin))); echo '<option ' . ($i == 0 ? 'selected=\'selected\'' : '') . ' value="' . $monthselect . '" >' . $monthdisplay . '</option>'; } } ?> </select> $begin_date = $_GET["dateselect"]; $end_date = date("Y-m-t", strtotime($begin_date)); Edited November 8, 2019 by jakebur01 Hello, Doing a little calendar where days are incremented as variable $i formatted like 'j' or single digit numbers 1,2,3 etc. (The calendar works fine) However for querying DB tables I need the day formatted as 'd' or 01,02,03 etc. so on any day I need to make this conversion. I can't find an easy solution though there must be one. Thanks in advance. Code: [Select] <?php //test day $i=7; $day=date('d', mktime($i)); echo "$day"; //Should be 07 ?> delete I am trying to compare values and if the month is not of 2 digits then the comparison goes wrong. Here is some hacked crap that doesn't work. if (strlen($_POST['m'] <= 1)){$month = "0".$_POST['m'];}else{$month = $_POST['m'];} if (strlen($_POST['d'] <= 1)){$day = "0".$_POST['d'];}else{$day = $_POST['d'];} <form> function GetDays(){ $Listd = '<select name="d">'; if (isset($_POST['d'])){$Listd .='<option value="'.$_POST['d'].'">'.$_POST['d'].'</option>';} for ($x = 1; $x <= date('d'); $x++) $Listd .= '<option value="'.$x.'">'.$x.'</option>'; $Listd .= '</select>'; return $Listd; } function GetMonths(){ $Listm = '<select name="m">'; if (isset($_POST['m'])){$Listm .='<option value="'.$_POST['m'].'">'.$_POST['m'].'</option>';} for ($x = 1; $x <= date('m'); $x++) $Listm .= '<option value="'.$x.'">'.$x.'</option>'; $Listm .= '</select>'; return $Listm; } Here is what I am comparing: Now: 201012141292327875 Submitted: 201110101292353200 // 2 digit month/day Now: 201012141292327984 Submitted: 2011991292353200 // not 2 digits month/day 2 hours is enough for me...can someone shed some light on this for me please? I'm trying to get a total number from the db where the month is the same and the ip is different. This is a stats script that someone else wrote, and I'm just trying to get a month-to-month total. Right now, it pulls the information out and displays the month with how many different ips came that month, the problem is, it lists like this: June - 41 - 41 June - 1 - 1 June - 1 - 1 June - 1 - 1 June - 1 - 1 June - 1 - 1 June - 9 - 9 June - 2 - 2 June - 2 - 2 June - 2 - 2 June - 1 - 1 June - 3 - 3 June - 2 - 2 June - 4 - 4 June - 1 - 1 June - 13 - 13 June - 154 - 154 what I need to do is grab all those numbers and give a total for that month, in this case, June. This is my query Code: [Select] $query = "SELECT date, COUNT(referrer)'referrer' FROM app_analytics WHERE appid = $userid AND date BETWEEN '" .$y_month . "' AND '" . $t_month . "' GROUP BY referrer ORDER BY date"; Can anybody help out? Thanks in advance Hello everyone I am coding a membership system for my usersystem on my website and I needed a little help. I have searched around quite a bit and can't find a working code. In my database I have the date the VIP was purchased and I was wondering if anyone had a code which would check if they've had VIP for over a month and if so, delete it from the database. I'm new-ish to MySQL and PHP and can't seem to code a working one. Good Evening, I have a working knowledge or HTML/CSS and right now I am learning/reading about PHP. Currently I am looking to build a website around an events calendar, let me explain more. A user would log onto the site, submit a form (with an event), this would then be added to a calendar as well a new page for the event details. The calendar would be fully visible to an visitor to the site. I would also like the ability to add a ticker on the homepage with the latest events added. How complicated is this to implement? And what are the basic requirements? I hope this makes sense. Thanks, Cain i have an events script that displays upcoming events, and i just add the event in a simple form, stores in database and shows on my control panel, and the clients control panel ( only clients events ) firstly what is the best way to sort by date? i enter the date into a text field like 12-04-11 but this when sorted doesnt appear in upcoming first? then secondly how cani have it so, past events no longer show up so, if date = > today do not show? |