PHP - Change Database From Mysql 4 To Mysql 5 Affects My Calendar Event Page
Similar TutorialsI am trying to create a calendar of Events for my company's website. When I search for this type of calendar, I can find code that runs the calendar from one Events table. However, we could have an Event that has multiple performances. (For example, Lily Tomlin could be performing at the Atwood Concert Hall in Anchorage on 09/09/11 and at the Vagabond Blues in Palmer on 09/10/11.) So we have two tables to draw the information from: Events and Performance I can successfully create a MySQL query (see below) with PHP coding that will make a listing (as demostrated on our website http://www.centertix.net/). Code: [Select] "SELECT Events.PublishDate, Events.EventOnSaleDate, Events.BldgContractDate, Events.SetUpComplete, Events.EventTitle, Performance.PerfID, Performance.startDateTime, Performance.endDateTime, Performance.PerfType, venues.VenueName, venues.VenueCode FROM (Performance RIGHT JOIN Events ON Performance.EventID = Events.EventID) LEFT JOIN venues ON Performance.VenueCode = venues.VenueCode WHERE Events.BldgContractDate Is Not Null AND Events.SetUpComplete Is Not Null AND Performance.PerfType='Public Event'"However, I'm not advanced enough to create the if-clause or while-loop to check to see if the Performance.startDate = the calendar's date and then place the info into the appropriate calendar grid box. I think have determined where it should be place in my PHP code, but need help getting the calendar to work. Here's the code where I think it should go: Code: [Select] for($list_day = 1; $list_day <= $days_in_month; $list_day++): if(($list_day == date("j",mktime(0,0,0,$this->month))) && (date("F") == date("F",mktime(0,0,0,$this->month))) && (date("Y") == date("Y",mktime(0,0,0,$this->month,$list_day,$this->year)))) { $this->calendar.= '<td class="'. $this->style .'-current-day">'; } else { if(($running_day == "0") || ($running_day == "6")) { $this->calendar.= '<td class="'. $this->style .'-weekend-day">'; } else { $this->calendar.= '<td class="'. $this->style .'-day">'; } } /* add in the day number */ $this->calendar.= '<div class="'. $this->style .'-day-number">'.$list_day.'</div>'; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $this->calendar.= '<div class="'. $this->style .'-text"><a href="">PERFORMANCE INFO</a></div>'. "\n"; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF NO MATCHES FOUND, PRINT NOTHING !! **/ $this->calendar.= str_repeat('<p> </p>',2); $this->calendar.= '</td>'; if($running_day == 6): $this->calendar.= '</tr>'; if(($day_counter+1) != $days_in_month): $this->calendar.= '<tr class="'. $this->style .'-row">'; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; Please help me plug the calendar in with the appropriate events! If you would like to see how far I have gotten, you can check out this link: http://www.myalaskacenter.com/calendars/calendarSample2.php Hi there! My name is Andy. I'm relatively new to PHP. Despite this, my project (an events listings website for a live music venue) is coming along at a steady rate. However, I have become somewhat confused by the following: I have a MySQL table named 'events'. The table contains the following obvious fields 'eventID', 'eventDate', 'eventArtists', 'eventDesc', 'eventEntryFee'. It can be edited from a basic content management page. I would like the main page of the website to pull all the information out of the database, displaying the up and coming week's events starting with today's event. Further, I'd like a 'next' option, giving the site user the choice to scan further ahead should they choose. Does anybody have any ideas where I should start? Thanks for reading, Andy Hi All, I have a form that enables the user to know events that occur in a specific city. Most of the time they get the results in a few seconds, despite the fact that many rows in various tables might be searched for detailed infos about the events in that city. However, this form partly relies on a table against which a MySQL event regularly does some operations. If the user uses the form while the event is being executed, they have to wait up to 30 seconds before getting the results, and sometimes only part of the html page is generated. Is there a way to avoid this lengthy waiting time ? I am wondering whether or not the best would be putting the site on maintenance while the event is being executed, with a "please come back in a few minutes" message. Thanks in advance for your help. Hi guys, just wondering if someone can help me i am currently trying to edit a MYSQL database through PHP and just wondering if you could take a look at the code i have and tell me where i have gone wrong. I have tried to use a tutorial but have got lost and need some help. This is for my final year project for University and really needs to be done soon so i would be really greatful if someone could help me out. Thanks code below: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <link rel="stylesheet" type="text/css" href="style.css"/> <title>Database Editor</title> </head> <body> <div id="page"> <img src="images/banner1.jpg" alt="banner"/> <div id="navi-container"> <ul id="navi"> <li><a href="index.php">Home</a></li> <li><a href="news.php">News</a></li> <li><a href="latest_products.php">Latest Products</a></li> <li><a href="gallery.php">Gallery</a></li> <li><a href="Admin_page.php">Administration</a></li> </ul> </div> <?php ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <h1>Database Editor</h1> <table class="inputtable"> <tr> <td class="label">Item Name:</td> <td class="inputtd"> <input name="Item_Name" type="text" class="standardwidth" /></td> </tr> <tr> <td class="label"> Item Image:</td> <td class="inputtd"> <input name="Item_Image" type="text" class="standardwidth" /></td> </tr> <tr> <td class="label">Item Description:</td> <td class="inputtd"> <input name="Item_Description" type="text" class="standardwidth" /></td> </tr> <tr> <td class="label">Item Number:</td> <td class="inputtd"> <input name="Item_Number" type="text" class="standardwidth" /></td> </tr> </table> <br /> <table class="radbuttons"> <tr> <td class="standardwidth"> <input name="op" type="radio" checked="checked" value="rdbase" /> Read from Database</td> <td><input name="op" type="radio" value="cdbase" />Change Entry (enter data in form)</td> </tr> <tr> <td class="standardwidth"> <input name="op" type="radio" value="adbase" />Add to Database</td> <td><input name="op" type="radio" value="ddbase" />Delete Entry (enter name in form)</td> </tr> </table> <br /> <input name="submit" type="submit" value="submit" /> <input name="reset" type="reset" value="reset" /> <br /> </form> <?php if (count($view->peopleList) > 0) { ?> <table class="datatable"> <tr> <th><strong>Surname</strong></th> <th><strong>First Name </strong></th> <th class="standardwidth"><strong>Address </strong></th> <th><strong>Phone</strong></th> </tr> <?php foreach ($view->peopleList as $person) : ?> <tr> <td> <?php echo $person->getSurname(); ?> </td> <td> <?php echo $person->getFirstname(); ?> </td> <td> <?php echo $person->getAddress(); ?> </td> <td> <?php echo $person->getPhone(); ?> </td> </tr> <?php endforeach; } ?> </table> <?php ?> <?php $dbc = mysql_connect ('****','***','salford*****') OR die('Could not connect to MySQL : ' . mysql_error() ); mysql_select_db ('****') OR die('Could not select the database : ' . mysql_error() ); $query = "SELECT * FROM ****** ORDER BY Item_Number"; $result = mysql_query ($query); ?> <body> <h1>Database</h1> <table border="1"> <tbody> <tr> <td>Item Name</td> <td>Item Image</td> <td>Item Description</td> <td>Item Number</td> </tr> <?php while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo " <tr> <td>$row[Item_Name]</td> <td>$row[Item_Image]</td> <td>$row[Item_Description]</td> <td>$row[Item_Number]</td> </tr> "; } mysql_close(); ?> $sql = 'INSERT INTO murrayfp10_ipad (Item_Name, Item_Description, Item_Number) VALUES (:Item_Name, :Item_Description, :Item_Number)'; $result = $this->dbh->prepare($sql); $result->execute(array( ':Item_Name' => $data['Item_Name'], ':Item_Description' => $data['Item_Description'], ':Item_Number' => $data['Item_Number'] )); return $this->dbh->lastInsertId(); } public function edittbl($data) { $sql = 'UPDATE murrayfp10_ipad SET Item_Name = :Item_Name, Item_Description = :Item_Description, Item_Number = :Item_Number WHERE Item_Name = :Item_Name'; $result = $this->dbh->prepare($sql); return $result->execute(array( ':Item_Name' => $data['Item_Name'], ':Item_Description' => $data['Item_Description'], ':Item_Number' => $data['Item_Number'], ':Item_Number' => $data['Item_Number'] )); } public function deletetbl($data) { $sql = 'DELETE FROM murrayfp10_ipad WHERE Item_Name = :Item_Name'; $result = $this->dbh->prepare($sql); return $result->execute(array( ':Item_Name' => $data['Item_Name'] )); } <div style="text-align:center;"> Copyright © M.Murray 2011 </div> </body> </html> I used to be good at this but I changed servers and everything is different... Heres my code so far: Code: [Select] <?php $rated=$_REQUEST['rated']; echo $rated; $rating=$_REQUEST['rating']; echo $rating; // Make a MySQL Connection mysql_connect("localhost", "********", "********") or die(mysql_error()); mysql_select_db("*********") or die(mysql_error()); $result = mysql_query("SELECT * FROM main WHERE username = '$rated'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $votes = $db_field['$rating']; $newvotes = $votes + 1; echo $newvotes; mysql_query("UPDATE main SET $rating = '$newvotes' WHERE username = '$rated'"); ?> Whats going on here is the colomb that I want to update comes as a variable $rated (That works) and then the database selects the row to update with $username (That works) and gets the variable $newvotes by taking the original value of the data its about to update and add 1 to it (That works) Then it updates the field to $newvotes.... I don't know why the update won't go through... there are no errors.... This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=330163.0 hi, does anyone have a way to take data from mysql and instert it into outlook or blackberry calendar? Has anyone done this before? i have the following VERY basic looking calendar to display the current month and <strong> on the current date; <?php /* Set the default timezone */ date_default_timezone_set("Europe/London"); /* Set the date */ $date = strtotime(date("Y-m-d")); $day = date('d', $date); $month = date('m', $date); $year = date('Y', $date); $firstDay = mktime(0,0,0,$month, 1, $year); $title = strftime('%B', $firstDay); $dayOfWeek = date('D', $firstDay); $daysInMonth = cal_days_in_month(0, $month, $year); /* Get the name of the week days */ $timestamp = strtotime('next Sunday'); $weekDays = array(); for ($i = 0; $i < 7; $i++) { $weekDays[] = strftime('%a', $timestamp); $timestamp = strtotime('+1 day', $timestamp); } $blank = date('w', strtotime("{$year}-{$month}-01")); ?> <table class='cal-table cal-table-bordered' border=1 style='table-layout: fixed;'> <tr> <th colspan='7' class='cal-text-center'> <?php echo $title ?> <?php echo $year ?> </th> </tr> <tr> <?php foreach($weekDays as $key => $weekDay) : ?> <td class='cal-text-center"'><?php echo $weekDay ?></td> <?php endforeach ?> </tr> <tr class='cal-row'> <?php for($i = 0; $i < $blank; $i++): ?> <td></td> <?php endfor; ?> <?php for($i = 1; $i <= $daysInMonth; $i++): ?> <?php if($day == $i): ?> <?php //database code here ?> <td><strong><?php echo $i ?></strong></td> <?php else: ?> <td><?php echo $i ?></td> <?php endif; ?> <?php if(($i + $blank) % 7 == 0): ?> </tr><tr class='cal-row'> <?php endif; ?> <?php endfor; ?> <?php for($i = 0; ($i + $blank + $daysInMonth) % 7 != 0; $i++): ?> <td></td> <?php endfor; ?> </tr> </table> how can i get data into this calendar from my 'events' table, to perhaps highlight the date of the event and show a hidden <DIV> when rollover. i have columns: 'eventStart' and 'eventEnd' and 'eventName' in the 'events' table. or shall i look for something else? this has to be super simple with no backend or multiple files being used etc..
thanks Hi Guys, first time poster, so I hope I have it in the right category. I've used a program called Training Peaks for years, great program and it does cost a few $$'s. I'm also going through the Php MySQL learning curve and thought why not build something basic that I could use rather than TP. I've been dabbling with php/mysql for a few years, nothing serious and have been looking at a few core calendar codes like Ajax, Lavarel and one built on html5. I was curious with your knowledge what might be the best way to look at this project (attachment). In a nut shell the option to create a session (training session) it this case, it for Triathlon (swim, bike & run) ability to set a session time, date, distance and maybe some notes. TP has a lot more data that feeds from Garmin data, that's a bit over my head at the moment, so ignore TSS IF's etc The attachment is the calendar in the back ground with the individual session open, again a lot more data there than what I need. Google calendar was an option, but why not make it fun and learn something! Thanks in advance.
i am looking for simple php mysql base event calender..that shows upcoming events...i would very helpful for your help.any tutorial.video.or helping link..??
Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
At the moment I am creating a search function for my website. The approach I have in mind is a pseudo-PHP database. To give an example: A HTML form will submit the results to a PHP file. HTML FORM - Colour: Black PHP RESULT PAGE - if ($_POST['color'] == 'Black') {readfile("./products/black/*.html");} HTML FORM - Price: <$50 PHP RESULT PAGE - if ($_POST['Price'] == '<$50') {readfile("./products/less50/*.html");} The problem here is if there is an item that is black and costs less than $50, then its going to be listed twice. There is probably some code I can write to ommit the listing of duplicate entries, but it is probably going to be messy, so I am wondering if its better to use a centralized MySQL database, rather than a pseudo-PHP database? I've never used MySQL and don't know much about it and this is my first real attempt at using PHP. Need some help I have 2 tables in a database and I need to search the first table and use the results from that search, to search another table, can this be done? and if it can how would you recommend that I go about it? Thanks For Your Help Guys! Hi, I am using the backbone.js and full calendar script in my website. However, on clicking OK in the popup to add events, no action is taking place. Actually the event should be displayed on that specific date on clicking OK. the cancel button is working fine. I am using the link http://blog.shinetech.com/2011/08/05.../#comment-2245 Help me please. Thank you in advance I got this Event Calendar Script off of a site and i like it but it reads from a Flat File Database and i would like it to read from a mysql database. Can someone help me set it up so it will read from a mysql database? here is the script where its calling from the flat file.. Code: [Select] $counterfilepath="calendar.txt"; if(file_exists($counterfilepath)) { $filehandle=fopen($counterfilepath,"r"); $pointer = 1; while(!feof($filehandle)) { $rowdata = fgets($filehandle); $day = floatval(substr($rowdata,3,2)); $eventlastpos = strpos($rowdata,'{')-1; if($eventlastpos<=0){$eventlastpos=255;} $event = rtrim(substr($rowdata,11,$eventlastpos-10)); $eventcaption = rtrim(substr($rowdata,$eventlastpos+2,strlen($rowdata))); $datalist = $this->eventsthismonth[$day]; $rowmonth = floatval(substr($rowdata,0,2)); $rowyear = floatval(substr($rowdata,6,4)); if($rowmonth==$month and $rowyear==$year) { if($eventcaption=="") {$eventcaption='';} else {$eventcaption='<b>'.$eventcaption.'</b><br>';} if($datalist=="") { $this->eventsthismonth[$day] = '<font name=Verdana size=1>'.$eventcaption.$event.'</font>'; } else { $this->eventsthismonth[$day] = $datalist.'<br><hr size=1 color=#E0E0E0><font name=Verdana size=1>'.$eventcaption.$event.'</font>'; } } $pointer = $pointer + 1; } fclose($filehandle); } and the flat file looks like this 07/13/2005|Technology Advisory Meeting{2:00pm I am workin on a event calendar and i ran into a problem.. it shows the calendar and the today's date and 1 event on each month but i want it to show all the events for each month. my problem is i can't figure out how to loop it so it will.. here is where im having trouble at.. Code: [Select] for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ){ echo "<tr>"; } if($i < $startday){ echo ("<td bgcolor='414141'> </td>"); } else { if (($i - $startday + 1) == $today && $currentmonth == $cMonth && $currentyear == $cYear){ echo ("<td bgcolor='FF0000'><center><font color='FFFFFF'>".($i - $startday + 1)."</font></center></td>"); } else { [color=red]// this is where i need it to loop[/color] if (($i - $startday + 1) == $eday && $eMonth == $cMonth && $eYear == $cYear){ echo ("<td bgcolor='0000FF'><center><a class='info' href='#'><font color='FFFFFF'>".($i - $startday + 1)."<span>".$event."<hr><br>".$event_des."</span></font></a></center></td>"); } else { echo ("<td bgcolor='595959'><center><font color='FFFFFF'>".($i - $startday + 1)."</font></center></td>"); } } if(($i % 7) == 6 ) { echo "</tr>\n"; } } } i marked where the loop needs to go in red.. currently i have the sql query right above it in my script but i tried putting it where i need the loop and i get a error in there or it duplicates the calender and sometimes the numbers. can some please help me? Thank you Outsider_Child howdy all I was wondering if anyone has any Basic Event calendar or a tutorial for a basic one.. I want to get a event calendar on my site but i want a basic one so i can tweak it to fit my likings. Thank you SilentHunter HI im sorry if i post in a wrong thread im new here and im still young on PHP environment.. here is my problem hope someone can help me to solve this one here we goes, i got a project that i need to make a event calendar. where the members can see the whole month calendar then if they click the day with mark the page bring them to other page where they can see what event going to have on that day. then if admin was log.in the admin can do add,edit,delete by simply clicking on the calendar... tnx if u have time please send me an email or leave message here or reply on this forum thank you so much Good day! I created a webpages and i have a login page consist of Username and Department. And i encountered problem in adding event in my calendar. This is the flow of my webpage: First I have a separate table for the user and calendar. In my user table it has a Username, Department, and Permission. In the permission I put True or False, only one user i put True because i want that user is the one who permitted to add event or if she is login the add event link appear, but if other login the add even0t did not appear. This is my code in login: <?php session_start(); session_regenerate_id(); if($_SESSION['loggedin']){ //the user is already logged in, lets redirect them to the other page header("Location:company.php"); } //require_once 'conn.php'; $db_name="dspi"; mysql_connect("localhost", "root", "") or die("Cannot connect to server"); mysql_select_db("$db_name")or die("Cannot select DB"); $department = mysql_real_escape_string($_POST['department']); $username = mysql_real_escape_string($_POST['username']); $sql=mysql_query("SELECT `Department`, `Username` FROM `tbllogin` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mysql_error()); $ct = mysql_num_rows($sql); if($ct == 1) { // im guessing this means that the user is valid. $_SESSION['loggedin'] = true; // now that the user is valid we change the session value. $row = mysql_fetch_assoc($sql); $_SESSION['username'] = $row['Username'] ; $_SESSION['department'] = $row['Department']; $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain'); if (in_array($row['Department'], $Departments)){ header ('Location:company.php'); }else{ echo "Incorrect Username or Department"; header ('Location:index.php'); } } ?> and this is my code in calendar page: <?php session_start(); $host = "localhost"; $username = ""; $password = ""; $dbCnx = @mysql_connect($host, $username, $password) or die('Could not Connect to the database'); $dbName = 'dspi'; mysql_select_db($dbName); ?> <html> <body> <script> function goLastMonth(month, year){ // If the month is January, decrement the year if(month == 1){ --year; month = 13; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month-1)+'&year='+year; } //next function function goNextMonth(month, year){ // If the month is December, increment the year if(month == 12){ ++year; month = 0; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month+1)+'&year='+year; } function remChars(txtControl, txtCount, intMaxLength) { if(txtControl.value.length > intMaxLength) txtControl.value = txtControl.value.substring(0, (intMaxLength-1)); else txtCount.value = intMaxLength - txtControl.value.length; } function checkFilled() { var filled = 0 var x = document.form1.calName.value; //x = x.replace(/^\s+/,""); // strip leading spaces if (x.length > 0) {filled ++} var y = document.form1.calDesc.value; //y = y.replace(/^s+/,""); // strip leading spaces if (y.length > 0) {filled ++} if (filled == 2) { document.getElementById("Submit").disabled = false; } else {document.getElementById("Submit").disabled = true} // in case a field is filled then erased } </script> <?php //$todaysDate = date("n/j/Y"); //echo $todaysDate; // Get values from query string $day = (isset($_GET["day"])) ? $_GET['day'] : ""; $month = (isset($_GET["month"])) ? $_GET['month'] : ""; $year = (isset($_GET["year"])) ? $_GET['year'] : ""; //comparaters for today's date //$todaysDate = date("n/j/Y"); //$sel = (isset($_GET["sel"])) ? $_GET['sel'] : ""; //$what = (isset($_GET["what"])) ? $_GET['what'] : ""; //$day = (!isset($day)) ? $day = date("j") : $day = ""; if(empty($day)){ $day = date("j"); } if(empty($month)){ $month = date("n"); } if(empty($year)){ $year = date("Y"); } //set up vars for calendar etc $currentTimeStamp = strtotime("$year-$month-$day"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); $counter = 0; //$numEventsThisMonth = 0; //$hasEvent = false; //$todaysEvents = ""; //run a selec statement to hi-light the days function hiLightEvt($eMonth,$eDay,$eYear){ //$tDayName = date("l"); $todaysDate = date("n/j/Y"); $dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; if($todaysDate == $dateToCompare){ //$aClass = '<span>' . $tDayName . '</span>'; $aClass='class="today"'; }else{ //$dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; //echo $todaysDate; //return; $sql="select count(calDate) as eCount from calTbl where calDate = '" . $eMonth . '/' . $eDay . '/' . $eYear . "'"; //echo $sql; //return; $result = mysql_query($sql); while($row= mysql_fetch_array($result)){ if($row['eCount'] >=1){ $aClass = 'class="event"'; }elseif($row['eCount'] ==0){ $aClass ='class="normal"'; } } } return $aClass; } ?> <div id="Calendar_Event"> <table width="350" cellpadding="0" cellspacing="0"> <tr> <td width="50" colspan="1"> <input type="button" value=" < " onClick="goLastMonth(<?php echo $month . ", " . $year; ?>);"> </td> <td width="250" colspan="5"> <span class="title" style="color:#FFFFFF"><?php echo $monthName . " " . $year; ?></span><br> </td> <td width="50" colspan="1" align="right"> <input type="button" value=" > " onClick="goNextMonth(<?php echo $month . ", " . $year; ?>);"> </td> </tr> <tr> <th>M</td> <th>T</td> <th>W</td> <th>T</td> <th>F</td> <th>S</td> <th>S</td> </tr> <tr> <?php for($i = 1; $i < $numDays+1; $i++, $counter++){ $dateToCompare = $month . '/' . $i . '/' . $year; $timeStamp = strtotime("$year-$month-$i"); //echo $timeStamp . '<br/>'; if($i == 1){ // Workout when the first day of the month is $firstDay = date("N", $timeStamp); for($j = 1; $j < $firstDay; $j++, $counter++){ echo "<td> </td>"; } } if($counter % 7 == 0 ){ ?> </tr><tr> <?php } ?> <!--right here--><td width="50" <?=hiLightEvt($month,$i,$year);?>><a href="<?=$_SERVER['PHP_SELF'] . '?month='. $month . '&day=' . $i . '&year=' . $year;?>&v=1"><?=$i;?></a></td> <?php } ?> </table> </div> <div id="New_Event"> <?php if(isset($_GET['v'])){ if(isset($_POST['Submit'])){ $sql="insert into calTbl(calName,calDesc,calDate,calStamp) values('" . $_POST['calName'] ."','" . $_POST['calDesc'] . "','" . $_POST['calDate'] . "',now())"; mysql_query($sql); } $sql="select calName,calDesc, DATE_FORMAT(calStamp, '%a %b %e %Y') as calStamp from calTbl where calDate = '" . $month . '/' . $day . '/' . $year . "'"; //echo $sql; //return; $result = mysql_query($sql); $numRows = mysql_num_rows($result); $check=mysql_query("SELECT * FROM tbllogin WHERE Username='xxx' AND Department='HRAD' AND Permission='True'"); mysql_fetch_array($check); if($check['Username']=='xxx' && $check['Department']=='HRAD'){ $_SESSION['isallowed'] = $check['Permission']; //if (mysql_num_rows($check)>0){ ?> <a href="<?=$_SERVER['PHP_SELF'];?>?month=<?=$_GET['month'] . '&day=' . $_GET['day'] . '&year=' . $_GET['year'];?>&v=1&f=true">Add Even</a><a href="<?=$_SERVER['PHP_SELF'];?>?month=<?=$_GET['month'] . '&day=' . $_GET['day'] . '&year=' . $_GET['year'];?>&v=1&f=true">t</a><?php }else{ echo 'You cannot Add New Event'; }?> </div> <div id="Cal_Event"> <?php if(isset($_GET['f'])){ include 'calform.php'; } if($numRows == 0 ){ echo ''; }else{ //echo '<ul>'; echo '<h3>Event Listed</h3>'; while($row = mysql_fetch_array($result)){ ?> <h5><?=$row['calName'];?></h5> <?=$row['calDesc'];?><br/> Listed On: <?=$row['calStamp'];?> <?php } } } ?> </div> </body> </html> In that code when the user log is xxx and when she click a date she want to add event the appear is "You cannot Add Event". I hope somebody can help me.. Thank you in advance... This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=348839.0 |