Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. DateTime::diff() has an optional 2nd argument which enables you to detect negative differences http://php.net/manual/en/datetime.diff.php
  2. Nor was the question about PostgreSQL being able to run commands.
  3. try $result = mysql_query($sql) or die(mysql_error());
  4. cataiin, No. Use nl2br() on output in the browser. Store data with just the newlines.
  5. If you get an "undefined variable" message it means what it says. You are using a variable that has not been given a value previously in the script.
  6. As we have no idea what $sql contains then what do expect us say? Have you tried checking what mysql_error() returns after running the query? That call to mysql_real_escape string() does nothing and is totally useless. What does this have to do with maths (this is the php maths forum)?
  7. Old proverb: "The only stupid question is the one that wasn't asked"
  8. Barand

    SQL error

    Based on my previous reply, SELECT r.roomid, r.`room-name`, r.price, r.`room-descript` FROM rooms r LEFT JOIN order o ON r.roomid = o.`room-id` AND o.checkin < '$checkout' AND o.checkout > '$checkin' WHERE o.`room-id` IS NULL DO NOT use "-" in column names (SQL treats them as minus signs). Use underscores "_"
  9. Barand

    SQL error

    In the diagram below, rooms E and F are available between the requested checkin and checkout dates. The test for a room being booked for all or part of the requested period is S < checkout AND F > checkin A LEFT JOIN between all rooms and rooms booked will give those available requested requested checkin checkout | | Room A S------------------F | Room B | S---------------F | Room C | S-------------F Room D S----------------------------------------F Room E S------------F | | Room F | | S-------------F
  10. The values need to be inside ()s INSERT IGNORE INTO table (a, b) VALUES (1,2) Edit: Ignore
  11. your date range test should be if(($today>=$remainder_date) && $today<=$renew_date)
  12. Then you need to subtract a month from the expiry date and check if today is between that date and the expiry date
  13. Use commas, not semicolons, to separate the individual records. INSERT INTO table (a,b,) VALUES (1, x), (2, y), (3, z); Semicolon terminates query
  14. or you could GROUP BY agent and GROUP_CONCAT the house details into a single field ready for emailing. Let the database query do the work.
  15. So you're talking about tens of millions then?
  16. try mysqli_fetch_row() instead of mysqli_fetch_assoc()
  17. If T1, T2 and T3 all have the same fields then why on earth are they three separate tables? Use a UNION.
  18. Why "60" when the requirement is for 1 month?
  19. priyankagound, That's a solution looking for a problem, unfortunately not this one. And you should have learned to use code tags by now
  20. priyankagound, keep up and read the previous reply by mac_gyver
  21. perhaps if ($someRole == $_POST['role']) && ($someRole == 'subscriber') { update_something(); } $_POST is not same as $_Post
  22. SELECT * FROM `dailyMasterLogs` AS logs LEFT JOIN `vessels` AS vessel ON logs.logVesselID = vessel.vesselName WHERE logs.logVesselID = foo ORDER BY $field $order
  23. So are you saying that writing "hello" to a numeric type column would be better than writing 0? If the input is supposed to be an integer then intval() will ensure it really is.
  24. http://www.nusphere.com/products/php_debugger.htm
×
×
  • 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.