Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. btherl

    Invoices

    invoice_id is generated by the invoice table. You would never have the invoice_products table generating it, because all that table does is refer to items in the other two tables.
  2. btherl

    Invoices

    If the invoices table has primary key invoice_id and the products table has primary key product_id, then you can create a table CREATE TABLE invoice_products ( invoice_id integer, product_id integer, product_count integer, cost numeric(9,2), ); For example. This will let you record any number of products along with an invoice, along with a count of how many products there were and the price (which can be per-product or a total)
  3. How about sending a udp packet that the game server will respond to, such as a request for stats? If it doesn't respond within 1 or 2 seconds, you can assume it's down. This seems like the best method. You could also try tcp and assume that if you get "connection refused", then the server is UP. If you instead get an error saying the server is unreachable, then you can ssume it's DOWN. Because the server must be up to refuse your connection. If it's down, it can only ignore your connection attempt.
  4. Do you just want to know if the IP is responding? You've got two options for that: 1. Send something via udp and see if you get a response 2. Use another protocol that the server understands, such as http, ftp, or icmp (aka "ping"). The problem with udp is there's no such thing as a udp "connection", so you can never ask php if you are connected or not. You can only send something and see if you get a response.
  5. dezkit, read the manual page for fread(). If you want to distinguish between empty string and false, use "=== false", with three "="
  6. I really don't understand what you are suggesting here. How would you store all the information in one database location without using several tables with columns?
  7. Is this for a single school? 1000+ simultaneous users I would think of as something statewide or nationwide. In any case, you should use a database. I imagine data integrity is more important than efficiency here.
  8. What does pg_last_error() tell you?
  9. You can use javascript to set a form value, then submit the form. Or you can send it using AJAX (which is a whole topic in itself).
  10. Try $result = mysql_query($query, $connection) or die("Error in $query<br>" . mysql_error());
  11. It sounds like you'll basically need one active apache process for each client. The limit there is your server's memory, and also apache's limit on number of concurrent threads (which you can increase if you have enough memory). CPU time won't be an issue if you sleep a little during your while loop between checks. Each while loop will occupy one apache thread if that's what you're wondering. If you instead open a new connection every n seconds for each client, the bottleneck will be the work done for setting up and shutting down each connection. With a powerful server and good coding (ie few or no database accesses on each request, most data in memcache, and a cacher like xcache), I have a feeling that this will scale better. There's no way to tell for sure other than to try it.
  12. There isn't any. You can make a copy of the array before sorting.
  13. If you convert all your time values into "seconds since epoch", which is the default return value of time(), and also comes out of strtotime(), then you can compare everything using "<" and ">".
  14. A good start would be converting it into an array. $lines = preg_split("/[\n\r]+/", $row['value']); Then you can loop over the lines, deciding if you want to indent or not for each one. At the end join them together using $final_value = implode("\n", $lines);
  15. It's entirely possible that that line generated the warning but ONLY if the earlier line that sets $id was not executed. Perhaps it's inside a conditional like "if" ? Can you put the entire script at pastebin.org and link to it?
  16. Ok, that's gzipped. There's two options here - first is to tell the server you don't want gzipped pages, second is to decompress them. To implement the first I think you need to set the Accept-encoding header. I don't have the detail of what you can set it to, you'll need to find that yourself. To implement the second, apparently there is a gzdecode() function but only in php 6. But perhaps you can write the data to a file and then use gzopen() and gzread() to decompress it.
  17. That's a tricky one, as you need to parse the css to know where to put the indents. Is it possible to include indents in the database itself? If you only have a single level of indentation you could have a while loop that goes through each line, and remembers if it's currently inside an item or outside. If it's inside then it indents, if it's outside (or at the "}" end marker) then it doesn't indent.
  18. You might be getting a compressed response or something that is not supposed to be readable. Try curl_setopt($ch, CURLOPT_HEADER, true); assuming $ch is your curl handle, and see if there's any clues in there. It might tell you the file is compressed (content-encoding), or it might tell you that you are getting something that is not plain text or html (content-type)
  19. I don't see how that warning can possibly come from that code. The first mention of $id is $id= (int) $_GET['id']; and the only warning that could generate is that the "id" index is not defined in $_GET. The second mention is a href=<?php echo "cart.php?action=remove_item&ids=" . $row["id"] .'&qty=1'. '&register='. $_GET['register']. '&id='.intval($id).""?>>Remove</a></p></div> but $id was explicitly set above. Even if $id is empty, it is still defined. Are you sure the code you have pasted is line 247?
  20. As long as your urls are correctly formed, parse_url() will give you all the individual bits. Then you can paste together the ones you need. I think this function expects them to look like http://domain.com/path/file.html. I'm not sure if it works if you leave out the "http://", for example.
  21. Ok I've verified that the way you are using array_multisort() should work. I would debug it as follows: 1. Check that the sorting code is actually being executed, by adding a print statement 2. Check that the array is sorted after the sorting code is executed. Can use var_dump() for this, for example: print "<pre>"; var_dump($params["RESULTS"]["PROPERTY"]); print "</pre>"; 3. If it's still not working, dump the array contents just before it goes into the smarty template. Is it sorted there? That should give you enough information to either pinpoint the problem or at least narrow down where to look.
  22. If the relative link starts with "/", you can strip the url down to the domain name and then add the relative link. If it doesn't, then you can remove any filename component at the end of the current url and THEN append it to whatever is left.
  23. Take a look at this thread on header errors The main point is you must either buffer your output (as the very first action in the script, before any output) or set your cookies before producing any output.
×
×
  • 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.