Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Can you try this: RewriteEngine on RewriteRule ^index\.html$ Test/new.html
  2. Please post your current code
  3. Please post your code (including the code that generates the submit button)
  4. Can you give more detail please? How do you know the utf-8 is bogus?
  5. Do you have an index on dl_id on the images table? Regardless of the answer to that, you can use this query to fetch all data in one go: SELECT dl_id, dl_name, pic_url, pic_thumburl FROM downloads JOIN images ON (downloads.dl_id = images.dl_id)
  6. "This function is currently only available to users who have bought a commercial GeoIP Region Edition. A warning will be issued if the proper database cannot be located." From http://php.oregonstate.edu/manual/en/function.geoip-region-by-name.php
  7. Looks like hitman got it I would also recommend changing the error message to this: echo "invalid file type: " . $_FILES['file']['type']; [/code] Or for debugging purposes, during script development only: echo "invalid file<br>"; var_dump($_FILES);
  8. Are you running this script on a web host or your own pc? Try running this script, and see if it says that curl is installed: <?php phpinfo(); ?>
  9. If you want "In table A but not in table B", then left join is the way. It looks like this: SELECT user_contacts.* FROM user_contacts LEFT JOIN online ON user_contacts.contact = online.onlineusr WHERE online.onlineusr IS NULL AND user_contacts.user='$user' ORDER BY user_contacts.contact ASC That will do this: 1. Take all rows from user_contacts 2. Filter by user_contacts.user = $user 3. Join with online, setting online's columns to NULL where no matching row exists 4. Filter for rows where online.onlineusr is null (that is, all rows which DON'T exist in table B but DO exist in table A)
  10. If you put get_file.php in a different directory, all should be fine. That's a good idea anyway, to keep the scripts seperated from the data.
  11. How does your get_file.php work? You can post the code if you want.
  12. What teng is saying is that you need a condition to sa how user_contacts and online are connected. It will look something like this: WHERE user_contacts.user = online.user Without that, MySQL thinks that user_contacts and online are totally unrelated tables, and it generates EVERY possible combination of results.
  13. Hmm.. benchmark them and see for yourself It's honestly very difficult to tell by looking at code whether it'll be faster or not, unless there is some overwhelming factor. The single large query probably has higher peak memory usage, but I would expect it to be faster. The multiple queries will have lower peak memory usage but I expect them to be slower. But I could be totally wrong. If your database is hosted somewhere distant from your script, then the single query will be MUCH faster, but I assume the database is on the same machine or on a fast local network.
  14. Add this line under "We are currently having connection problems": print "The error is: " . mysql_error();
  15. function combine_time_and_price($time, $price) { $result = array(); $length = count($time); # Assume $price is the same length for ($i = 0; $i < $length; $i++) { $result[] = array( 'time' => $time[$i], 'price' => $price[$i], ); } return $result; } Note that this code will only work if your arrays are indexed with consecutive numbers starting at 0 (which yours are).
  16. now() - '15 minutes', not now() .. there will never be users who last visited in the future
  17. Did you check for errors in all of your mysql queries? Especially in the one that returns $result_NewsItems? Make a change to mysql_query() similar to the one in my previous post (adding die(...))
  18. This query should list the active users: $sql = "SELECT * FROM members_info WHERE last_visit > now() - '15 minutes'"; I'm not 100% sure of mysql's interval syntax, since i'm a postgres user, so that '15 minutes' may need to be something else. If you have many users and the query is slow, an index on last_visit may help.
  19. "last visit" meaning the last time they accessed a page? Is that data stored in the database? If so, show us either the database table definition, or the queries which access that data, and we can help you with some SQL to find active users.
  20. Try this: $db->query('LOAD DATA INFILE \'sqlsnow.txt\' INTO TABLE weather;'); Mysql commands are not "native" to php, instead they are treated as strings.
  21. The problem with recording user logout is that not all users logout So you need a timeout mechanism. So let's say you choose 30 minutes as the timeout. If you only record user login time, how do you know when to time out the user's session? So you need to record also the last time the user was active. That lets you time out their login after a period of time. So once you have the "last active" time in the database, you can use that to count how many users are active, using whatever method you choose. Could be "active in the last 10 minutes" or "last 30 minutes", depending on what is appropriate to your site.
  22. How do you record which members are active?
  23. btherl

    JOINS

    Can you show us the output of each? In the first query I notice your "ORDER BY" clause doesn't makes sense. It should be ordering by max(s1.sih_id), not by s1.sih_id.
  24. Instead of $result_NumberOfItems = @mysql_query ($query_NumberOfItems); do $result_NumberOfItems = mysql_query ($query_NumberOfItems) or die("Error in $query_NumberOfItems: " . mysql_error()); That will tell you if there are any errors in your SQL.
  25. That loop is fine. It works because mysql_fetch_array() always returns the next row. So each time around the loop, you are getting the next row. I would write it like this instead: while ($row = mysql_fetch_array($result_NewsItems, MYSQL_BOTH)) { echo '<p>' . $row['news_Item_Date'] . '</p>'; echo '<p><strong>' . $row['news_Item_Heading'] . '</strong></p>'; echo '<p>' . $row['news_Item'] . '</p>'; echo '<p>' . ' ' . '</p>'; } When there are no more rows left, mysql_fetch_array() will return false, and the loop will finish. The advantage of this version is that you don't need to know how many items there are. Instead, you let mysql_fetch_array() tell you when to stop.
×
×
  • 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.