Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. If the system can't create the file in the directory you specify, it will fall back to a default. You might want to try "C:\\tmp" as your directory, if that's where you want to make your temporary files. The webserver must have access to write there, but if it can write to c:\windows then it can write anywhere
  2. Please post your full code, including the part which calls budget.php
  3. Also, this will not do what you want it to: if(!mysql_query($qry,$con)); { die("connection error:".mysql_error()); } You must remove the ";" at the end of the first line I copied and pasted. Otherwise the die() will execute every time, regardless of if the query succeeds or fails.
  4. Ok.. solution 1 (in SQL) Construct a query looking like "WHERE $talent = 'yes' OR $talent2 = 'yes' OR $talent3 = 'yes'". For each talent after the first, you add another "OR". Then use that query. Solution 2 (in PHP) Use the name as an array key: $talentresults["$firstname-$lastname"] = array($row[firstname], $row[lastname]); That can go in the inner loop, in place of the echoing out. That will remove duplicates naturally, because any identical names will overwrite each other. Then you can loop through that array and print out each name.
  5. Edit: Oh wait, that's not right.. let me think some more
  6. Apparently this function can tell you how many rows were matched, in addition to how many were changed. That may be good enough for some purposes. http://www.php.net/manual/en/function.mysql-info.php
  7. The elements you need to put that together are 1. Putting data in mysql 2. Parsing RSS feeds 3. Looping over the parsed data, putting each item into mysql So if you learn each of those individually (a much easier task than all at once), you will be set for writing your script!
  8. Will that tell you a row is affected if you update it to the exact same value it was before?
  9. It just occurred to me.. does the user submit ALL fields, and you want to test which are different before updating? In that situation, the safest way is to check every field individually and act appropriately. The simplest way is to update them all. It depends on how much effort you want to expend.
  10. UPDATE table SET field1 = 'value1', field2 = 'value2' WHERE key = 'key_value' That's actually the more common update syntax, which allows natural updating of only a few fields. Key is whatever column you use to identify a row (probably username or user_id).
  11. Try using the Live HTTP Headers firefox extension to capture the headers for both your local and online server, and look for differences. If possible, use something similar for IE. Sometimes an apache setting (such as mod_gzip) will cause different headers to come out. Quoting the filename may help too.. who knows? Headers are always messy to deal with.
  12. What output does your current code give? And how come there is no for loop or while loop?
  13. Can you just add | to the html? If that's not what you want, could you explain in more detail please? In particular what does "correctly" mean for your situation?
  14. Check here: http://sg2.php.net/manual/en/function.mail.php Your mail() seems to have an extra parameter
  15. Does this error appear in your browser? A google search indicates that it may be due to registry corruption. More details will help us narrow it down.
  16. You can't use "-" in a variable name. Try "_" (underscore) instead. Additionally, you should write variable accesses within a string like this: $string = "something {$ARRAY['element']} somethingelse"; The {} will protect it from being misinterpreted. The single quotes inside will also help against misinterpretation by php.
  17. Mysql uses this syntax LIMIT $offset, $rownum So for 3 rows beginning at the 0th row use LIMIT 0, 3 Be warned that limit syntax is not standard across all SQL systems. You will need to use the MySQL manual to find MySQL's syntax.
  18. btherl

    Nested tables

    If performance is your primary concern, I think the best approach would be to describe what you want to do, and ask a mysql guru to suggest an efficient approach. What you've done is suggest an approach and ask how to implement it.. but there may be much better approaches. I am not a mysql guru, which is why I am not suggesting anything But I will say that creating large numbers of tables is usually bad database design, unless you have a good reason to do it (eg partitioning).
  19. Thanks thorpe! I just learnt a whole lot about how complex php's streams and wrappers and so on really are
  20. I found the following.. if (is_resource($fp) && get_resource_type($fp) === 'stream') { ... } But it doesn't distinguish between stream types.. to do that you need to use stream_get_meta_data() and look even deeper. I guess that is the price of flexibility.
  21. Is there any is_file_pointer_valid() in php? Something which will tell me either "Yes, that's a file pointer" or "No, whatever that thing is it isn't a file pointer"
  22. Can you post your current php code? Alternatively you can try to add something like this yourself: $last_subcatid = null; while ($row = mysql_fetch_assoc($result)) { if ($row['subcatid'] !== $last_subcatid) { # New subcatid. We must print out the full data. } else { # Still the same subcatid. Print out only the element } }
  23. If you're using count(*), you should request the first column of the first row of the result. That will be your count. $count = mysql_result($result, 0, 0); But if you need to run the full query anyway, then mysql_num_rows() is better. If you don't need to run the full query anyway, count(*) is better.
  24. You'll have to make them up then. The original programmer also made up the variable names. For example, $O1bh is a file pointer for reading from "hi.cfg". $O1vv is a buffer for reading from $O1bh. $O1d1 and $l1d2 look like a key and value from iterating over $HTTP_GET_VARS. If you're not experienced with php you'll have a lot of trouble.. but you'll also learn a lot
×
×
  • 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.