Jump to content

Technocracy

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by Technocracy

  1. Bump? Am I allowed to do that, I don't know? This is what I am trying to get:
  2. Hey guys, I couldn't really think of a decent topic title for this but I hope by the end of it you'll know what I mean. Brief background: I work in an IT department in a school. I am in the process of writing a page to show room and resource booking for the current day and for the next day. There are six blocks that bookings can be made (before school, periods one-four, after school). I have written a query to display all the bookings for a given day. I have looped the six available periods to it has a header for them, and have done the same for containers for the bookings. What I am having problems with is getting it to show under the correct period for the start time and end time for the booking. For example, if a booking starts and ends period three, I want it to show just for period three. If it is a daily booking, it goes on all day. My query is this and I am happy with it - phpmyadmin display everything I want and the start time and end time are correct. ( SELECT `bno` AS `bookingid`, UPPER(`whofor`) AS `name`, `timestart`, `timeend`, `where` AS `room`, '' AS `comments`, TRIM(TRAILING '||' FROM `What1`) AS `equipment`, IF(`date` = '1', '1', '1') AS `type` FROM `booked` WHERE UNIX_TIMESTAMP(CONCAT_WS('-', `year`, `month`, `day`)) = '{$time}' AND `active` = 'yes' AND `timestart` != 'all' ) UNION ( SELECT `bno` AS `bookingid`, UPPER(`whofor`) AS `name`, '1' AS `timestart`, '6' AS `timeend`, `where` AS `room`, '' AS `comments`, TRIM(TRAILING '||' FROM `What1`) AS `equipment`, IF(`date` = '1', '1', '1') AS `type` FROM `booked` WHERE UNIX_TIMESTAMP(CONCAT_WS('-', `year`, `month`, `day`)) = '{$time}' AND `active` = 'yes' AND `timestart` = 'all' ) UNION ( SELECT `bid` AS `bookingid`, UPPER(`name`), `period`, `period`, IF(`room` = '8', 'Lower Laptops', 'Middle Laptops') AS `room`, `comments` AS `comments`, '', IF(`timebooked` = '2', '2', '2') AS `type` FROM `bookedrooms` WHERE UNIX_TIMESTAMP(CONCAT_WS('-', `year`, `month`, `day`)) = '{$time}' AND `room` IN(8,9) AND `name` != 'not available' AND `active` = 'yes' ) ORDER BY `timestart`, `type` ASC $time = (isset($_GET['tomorrow'])) ? strtotime('tomorrow 00:00') : strtotime('today 00:00'); Just wondering if anybody here has ever done anything similar to this to give me a hand. Thanks in advance!
  3. Okay, ignore this. I found out a previous rule was stopping it from working. I changed the position of the rules in .htaccess and it's working fine =]
  4. I'm making the pagination for blog entries but I'm not sure how to get it the way I want. The rule is: RewriteRule ^blog/page-([0-9]+)/?$ /blog.php?page=$1 [L] I want it to look like http://www.example.com/blog/page-1/ but it doesn't like it, presumably because of the - in the rule. I can only get it to work if it's http://www.example.com/blog/page/1/ Thanks in advance!
  5. <?php mysql_query(" DELETE FROM `table` ORDER BY `auto_incremental_key` ASC LIMIT 10 "); ?> Presumably that's what you mean. EDIT: too slow but yeah.
  6. <?php function ui($username) { global $user; $query = mysql_query(" SELECT * FROM `users` WHERE `username` = '".mysql_real_escape_string($username)."' LIMIT 1 "); if (mysql_num_rows($query) == 1) { $user = mysql_fetch_array($query, MYSQL_ASSOC); return true; } else { return false; } } // #### // Example if (ui('test')) { echo htmlspecialchars($user['username']); } else { echo "Sorry, info for this user not found."; } ?> Not exactly what you want but you get the idea.
×
×
  • 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.