Jump to content

stangn99

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by stangn99

  1. Ok..so i'm stuck. How would I use mysql's DATEDIFF to subtract a date in the database called 'expire' by the current date and time? This doesn't work: $result = mysql_query ("SELECT * FROM sample WHERE username = '$username' AND DATEDIFF('$today', 'expire'");
  2. Thanks for the information guys. I looked at the MYSQL page on DateDiff. I'm going to try this route first. I'll post back if I hit any speed bumps. Thanks again.
  3. Hey guys, How would I go about subtracting Today from a previous day to find the difference? For example, I want to subtract TODAY from a previous date in my database, to determine if the difference is greater than 1 day. Any ideas? I tried doing the subraction in TIMESTAMPS, but when I convert the date back to Y-m-d H:i:s, I got some weird year and time.
  4. Hey guys, I'm going to start working on a simple php/mysql project, and wondering if you guys could point me in the right direction. Here is what I want to do: 1. User is presented with a simple form asking a series of questions (including email address) 2. Based on the answers, a specific download link is emailed to the user 3. store all inputted information in the database. I'm still not sure if I want the email process to be automated, or "held" until the information is reviewed, then download link sent. Does anyone know if a script already exist for this? I don't need to create user accounts, I just want to obtain user information every time they want to download something. Thanks for any help.
  5. Alas....SUCCESS. I would like to thank you for your help in allowing me to successfully put this thing together. It is working perfectly with timestamps and with your suggested MySQL query. THANK YOU.
  6. You are storing the values as a time format and the query is then comparing a time to a datetimestamp. I would suggest using datetimestamps for the start/end times in the database. Then you do not need the date field for the record since you can ascertain that from the start/end values. You are GOD. I haven't 100% got it working, but I think i'm EXTREMELY close. I'm going to do some more tinkering. Re: timestamp... yes - this makes total sense. I'm going to try out just using timestamps vs. H:i:s
  7. Here is the ECHO of the Query itself: SELECT * FROM bookingdata WHERE meetingroom = 'fishroom' AND bookTimeFrom < '1272029400' AND bookTimeTo > '1272020400' I tried to echo the result of the query, but I only get: Resource ID #4 if I echo the result using: while ($row = mysql_fetch_array($query)) { echo $row['bookTimeFrom']; echo $row['bookTimeTo']; } I get 10:00:00 14:00:00
  8. Looks like its not going to work either. No matter what time values I select, it always gives me a conflict. If I select a totally new date with no booking, it still gives me a "conflict". This is the code i'm using: $query = mysql_query("SELECT * FROM bookingdata WHERE meetingroom = '$meetingroom' AND bookTimeFrom < '$bookTimeTo' AND bookTimeTo > '$bookTimeFrom'"); $numrow = mysql_num_rows ($query); if($numrow != 0) { echo 'conflict'; } else { echo 'no conflict'; }
  9. Alright... i'm going to try to implement this. I'll be back in a few minutes with my results.. it might take me a while
  10. This is embarrassing. I'm trying to learn it though Here is what I have now: $query = mysql_query("SELECT * FROM bookingdata WHERE meetingroom = '$meetingroom' AND bookTimeFrom < '$bookTimeTo' AND bookTimeTo > '$bookTimeFrom'"); while ($row = mysql_fetch_array($query)) { $from_compare= strtotime($row['bookTimeFrom']); $to_compare= strtotime($row['bookTimeTo']); } $intersect = min($bookTimeTo, $to_compare) - max($bookTimeFrom, $from_compare); if ( $intersect < 0 ) $intersect = 0; $overlap = $intersect / 3600; echo $overlap; $bookTimeFromcvb = date("H:i:s", ($bookTimeFrom)); $bookTimeTocvb = date("H:i:s", ($bookTimeTo)); if ( $overlap <= 0 and $bookTimeFromcvb!=$bookTimeTocvb) { Are you saying I should adjust the WHILE look to look something like this? while ($row = mysql_num_rows ($query)) { -------------------- } ? If nothing comes up, proceed with the booking and if something does come up, stop the booking? Could I use an IF statement within the WHILE loop to somehow check if anything was returned (like using empty($row)) ? Again... sorry i'm new to all of this. I've really enjoyed working on this little project and would love to hammer this last problem out
  11. MJ, Would I need to alter my min/max overlap check? Sorry for the lame question. I'm really new to this and only was able to get this far with the help of forums, php..net, and random google searches. Thanks so much for your help.
  12. I'm working on making a simple room booking system w/ php+mysql. Users select a date from a drop down box, select "time from" from a drop downbox, and "time to" from another drop down box. For any given day, there can be 1 or more bookings. My code seems to work find if there are 2 bookings, but when there are more than 2 bookings things go wonky. For example, users will booking the following: Date: April 23rd 2010 Meeting room: boardroom 9:00-11:00 12:00-1:00 ** At this point, if I try to book a room from 10:30-12:00, it won't let me because of the overlap. Now if do the following: Date: April 23rd 2010 Meeting room: boardroom 9:00-11:00 12:00-1:00 3:00-4:30 and than add ANOTHER booking for: 8:00 - 11:00 it will allow it, even tho there is overlap But, if I change 8:00 - 11:30, it will complain about an overlap in time. WTF?! Here is my code. Any help would be greatly appreciated. I'm willing to try anything at this point...so please don't be shy. :'( <?php $userid = $_POST['userid']; $bookTimeFrom = strtotime($_POST['bookTimeFrom']); $bookTimeTo = strtotime($_POST['bookTimeTo']); $meetingroom = $_POST['meetingroom']; $bookdate = $_POST['bookdate']; $today = $_POST['today']; $comment = $_POST['comment']; $fullname =$_POST['fullname']; $query = mysql_query("SELECT * FROM bookingdata WHERE bookdate='$bookdate' AND meetingroom='$meetingroom'") or die(mysql_error()); // Select all the rows while ($row = mysql_fetch_array($query)) { $from_compare= strtotime($row['bookTimeFrom']); $to_compare= strtotime($row['bookTimeTo']); } $intersect = min($bookTimeTo, $to_compare) - max($bookTimeFrom, $from_compare); if ( $intersect < 0 ) $intersect = 0; $overlap = $intersect / 3600; echo $overlap; $bookTimeFromcvb = date("H:i:s", ($bookTimeFrom)); $bookTimeTocvb = date("H:i:s", ($bookTimeTo)); if ( $overlap <= 0 and $bookTimeFromcvb!=$bookTimeTocvb) { echo 'There are no time conflicts.+++++ $conflict <br><br>'; $query = "INSERT INTO bookingdata (ID,userid,bookdate,comment,meetingroom,today,bookTimeFrom,bookTimeTo) VALUES ('','$userid','$bookdate','$comment','$meetingroom','$today','$bookTimeFromcvb','$bookTimeTocvb')"; mysql_query ($query) or die ('error updating database'); echo "<script>alert('Your meeting has been booked. Click OK to return to the main page.'); location = 'book.php?userid=$userid';</script>"; } else { echo "<script>alert('There is either a time conflict, or an invalid time selection. Please click OK to adjust time, or try another room'); location = 'book.php?userid=$userid';</script>"; } ?> p/s: this is a small project, and i'm pretty new to this. Please go easy on me
  13. I'm looking to get something similar to http://www.overnightprints.com/main.php?A=designer&step=2&bg_id=23365&BG=img/nb/f45427a1d200a5_full.jpg&bgback=img/nb/f45427a1d200a5_full.jpg And depending on requirements: http://www.overnightprints.com/designer/main.php?A=flashdesigner&new=1&p=bc&ver=1.0.34 The most important thing is that once the user submits their Business card or letterhead or whatever, I would need it to be ready in the form of a PDF file which I can print from. Can anyone give me an idea as to where I can learn more about this topic? What I would need? Any applications I can purchase which already do this? Thanks in advance for any help.
  14. Thanks for the info. I didnt' mean I wanted the content to be the same. I meant the layout. So I guess I should start out by writing down what I exactly need to have, where I want it to positioned and go from there. I will try to contact the site owner and ask if they used a CMS. I'm basically looking for something really simple. Ill do a little more research also on easy to use (lite) CMS that will do what I need. Thanks.
  15. Hello everyone, I may have put this in the wrong section...if so, please move. Here is what I want to try to do. I would like to put together a tutorials website. I'm not sure what exactly I want to do it for..but I want to keep myself busy with something. I've tried playing around with CMS like Joomla, Typo3, phpWebsite, etc. The problem is, I'm not sure if I am even in the right direction. An example of the layout I am looking for is over at www.pslover.com/. I want that example same layout. A menu on the left side that may read "auto repair, motorcycle replair, etc"...once clicked, a list of "guides" will load on the right side of the menu with small thumbnails for each guide. I just need a little push in the right direction. Are the people at www.pslover.com using a CMS? if so, which one? I need it to be exactly like that Thanks for any help at all.
×
×
  • 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.