Jump to content

zed420

Members
  • Posts

    160
  • Joined

  • Last visited

    Never

Everything posted by zed420

  1. Hi All Can anyone please tell me where am I going wrong in code below it fairly straight forward, Style switcher works fine. The problem is When I'm using Firefox background image doesn't show but there no problem in IE. why???? <!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="styleSheetSwitcher.js"></script> </head> <body><center> <div id="main">Hello <div id="centerbox">world</div> </div></center></body> </html> CSS code #main { position: relative; background-image:url(images/Driving_bkg3.gif); background-repeat: no-repeat; height: 100%; left: 5%; } #centerbox { margin: -20% 3% 0 40%; padding: 0%; width: 41%; height: auto; background-color:#C9F; }
  2. Thanks everyone, Sorted at last this is the final out come SELECT COUNT(*) AS Cnt FROM booking WHERE request_date = '$request_date' AND $e_time > s_time AND $s_time < e_time
  3. Its a form with drop-down boxes of start time and end time A day booking are from 08:00 to 21:00 normally its 1hr a lesson but when its a test its 2hrs. what I don't want is a duplicate of any lesson or Over lapping any lesson. Zed This is my table booking CREATE TABLE booking ( b_id smallint(5) NOT NULL auto_increment, `dateTime` char(15) NOT NULL, user_id smallint(5) unsigned NOT NULL, s_time varchar(10) NOT NULL, e_time varchar(10) NOT NULL, request_date varchar(20) NOT NULL, PRIMARY KEY (b_id), KEY user_id (user_id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
  4. Thanks for your reply I've already tried what you've posted that gives you duplicate bookings the very thing I'm trying to avoid. Thanks Zed
  5. Hi All I've managed to get somewhere with the query below with some help but it has a small problem after rigorous testing I found there is a small glitch e.g. Let’s say if I book from 10:00 to 13:00 and someone tries to book it from 08:00 to 21:00 (all day) IT WILL BOOK, meaning it will over lap. I have tried to sort it but failing miserably, anyone with any thoughts Thanks Zed SELECT b_id, COUNT(*) AS Cnt FROM booking WHERE request_date='$request_date' AND ( ($s_time >= s_time AND $s_time < e_time) OR ($e_time > s_time AND $e_time <= e_time) ) GROUP BY b_id
  6. Thanks for your reply but Unsuccessfull again. This is the background of it, A typical day's diary starts from 0800 till 2100, normally you would book an hr but just to test the script I booked 0800 to 2100 so that means all day has been booked NO other booking can be taken for this day if I DO NOT select the varibles 8 & 21 IT WILL book again and again . ????? why why????? How can I avoid that, s_time and e_time are numbers in database, this is the query I'm using Thanks Zed $query = "SELECT b_id, COUNT(*) AS Cnt 2.FROM booking 3.WHERE request_date='$request_date' 4.AND e_time > '$s_time' 5.AND s_time < '$e_time' 6.GROUP BY b_id"; 7. $result = mysql_query($query); 8. $row = mysql_fetch_assoc($result); 9. if($row['Cnt'] > 0){ 10. error_message('Sorry, this time is already booked. Please choose another'); 11. } else {
  7. Thanks for your reply but I'm no joy. :'( :'( :'(
  8. Error SQL query: SELECT COUNT( * ) AS Cnt FROM booking WHERE request_date = '$request_date' AND e_time > '$s_time' AND s_time < '$e_time' GROUP BY Cnt LIMIT 0 , 30 MySQL said: #1056 - Can't group on 'Cnt'
  9. Thanks for your reply but I'm getting this msg, Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\calendar\booking.php on line 75 thanks Zed
  10. Hi All This query below works and avoids all the Overlaping BUT only for the first recored and thereafter it overlaps. Any thoughts please ??? Zed $query = "SELECT COUNT(*) AS Cnt FROM booking WHERE request_date='$request_date' AND e_time > '$s_time' AND s_time < '$e_time'";
  11. This code works but only for the first record meaning that you can not insert any more same records as the first one but after that any other record can be duplicated. why??
  12. Sorry for not making myself clear, I'm POSTING hrs from a dropdown form, if the hr(s_time) from 8am to 9am has been booked(already in database) and someone tries to book this hr the error MSG should come up saying that it been booked please choose another. Zed
  13. Thanks for your reply, it still not having it Zed
  14. All I'm trying to do is look into the database if there is a similar s_time as POSTED one, give an error msg else insert into databse. Zed
  15. Hi All Can someone please tell me what am I doing wrong in this query??? Its inserting everthing even those date that are already there. So basically its this line that's not working. if (($result) == ($_POST['s_time'])) { why??? Many thanks Zed function insert(){ $b_id = $_POST['b_id']; $dateTime = $_POST['dateTime']; $user_id = $_POST['user_id']; $s_time = $_POST['s_time']; $e_time = $_POST['e_time']; $request_date = $_POST['request_date']; $query = "SELECT s_time,request_date FROM booking WHERE request_date = '$request_date'"; echo "$query"; $result = mysql_query($query)or die(mysql_error()); if (($result) == ($_POST['s_time'])) { error_message("Sorry, this hour/s is already booked please choose another !"); }else{ $query = "INSERT INTO booking VALUES (NULL,'$dateTime','$user_id','$s_time','$e_time','$request_date')"; if (@mysql_query($query)) { comfirmed_booking(); } else { echo '<p>Error adding submitted Information: ' . mysql_error() . '</p>'; }//end of else }//end of if }//end of insert
  16. Thank you all manage to sort it. Thanks Zed
  17. this is what got SELECT * FROM booking WHERE request_date = '1251586799'
  18. Thanks for your reply but that didn't work, there are no errors just its not fetching the records for Clicked date. Zed
  19. Hi All Can someone please tell me what am I doing wrong in this query??? Its not giving me anything? total blank, there is diffinatley data in this table on different dates. Many thanks Zed $query = "SELECT * FROM booking WHERE request_date = '$request_date'"; Full code $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = time(); $request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second if($today > $request_date) { echo "<font color=red>Error, Post date for Booking any lessons. Please choose the avialable date from tomorrow. </font>"; // post date }else{ .....(I took some code out from here) $query = "SELECT * FROM booking WHERE request_date = '$request_date'"; $result = mysql_query($query)or die(mysql_error()); while ($row = mysql_fetch_array($result)) { extract($row); echo " ".$row['request_date']." ".$row['s_time']." ".$row['e_time']." "; }
  20. Thank you mjdamato that is wonderful. Works like charm Zed
  21. Can I be cheeky and ask you if its possible to gray out the hrs that shouldn't be clicked. e.g. if start time is clicked on 9am the end time box 8 and 9 should be grayed out. is this possible ??? Thanks Zed
  22. Thank you very much that is a great help Zed
  23. Hi All I wonder if someone can help me i don't know much about JavaScript. I'm working on a PHP file, it has two dropdown boxes 'starttime' and 'endtime' I want it so that if someone selected 9am 'starttime' the 'endtime' should change to 10am onwards. so basiclly gap of 1hr. Is this possible with Javascript? many thanks Zed
  24. MadTechie you've been wonderful thank you very much for all your help Zed
  25. Here you go, this one doesn't let you book for today but I DON'T want the error if its same day. I want it so the people can book it for the same day. thanks for all this Zed $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = time(); $request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second if($today > $request_date) { echo "Error, Post date"; // post date }else{ echo 'You are about to book a lesson for <div class="everyday">'.date('j F Y', $request_date ).'</div>'; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.