Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Do you want in-game time to follow real time, but at a faster rate?  If so, it's probably easier if you calculate game time from real time each time rather than storing it.
  2. btherl

    INSERT problem

    Which unique constraint is being violated?  Can you paste the error message? If you're getting "duplicate" rows from a query, you can use 'select distinct on ( ... )' to make them unique according to certain conditions.  The particular row you get will be random unless you order your results. By "duplicate" I mean that the rows are not identical, but they still violate some kind of uniqueness constraint that you want to enforce.
  3. I don't think you can give an alias to the table being updated. How about: UPDATE imports.menssoccer SET employee_id = uem.id FROM users.employees uem WHERE employee_id = uem.tax_id
  4. Thanks for the suggestion!  I solved this by using pcntl_exec(), thus avoiding php's shutdown code. pg_pconnect() doesn't work unfortunately, as the children believe they are the only running php process.  So they shut down all persistent connections on exit.
  5. SELECT * FROM dg_tags t LEFT JOIN (dg_media_tags mt) ON (t.tag_id = mt.tag_id AND mt.media_id != 6) WHERE mt.tag_id IS NULL ORDER BY t.tag_title How about this?  The logic is that the left join will put NULL for every column in mt where there is no corresponding tag in t.  So the "IS NULL" condition will give you only these. If you can't get it working, use a subquery which selects all the currently set tags, and specify "where tag_id not in (subquery)"
  6. A better structure is to have one row for each friend relationship.  You'll need 2 tables. The first table will store the user's name, user id and other data (password, name, etc etc). The second table will have two columns, "id1" and "id2".  A row in that table means "id2 is a friend of id1". The problem with using columns is that you don't know how many columns you need.  Rows make life much easier :)
  7. There's no limit (in theory), but huge queries can hit resource limits sometimes.  Can you post your query and the error message?
  8. It looks to me like you want... [code]SELECT DISTINCT username, userid, email     FROM plmatchdata     JOIN plpredictiondata USING (matchid, lid)     JOIN pluserlids USING (userid)     JOIN pluserdata USING (userid)     WHERE lid = '$lid'     AND matchdate >= '$todaysdate'     AND week = '$ww'     ORDER BY matchdate[/code] Essentially, the USING (userid) means "Join these tables where userid matches). First you join plmatchdata and plpredictiondata where the matchid column matches. Then you join with pluserlids and pluserdata where the userid matches. The "DISTINCT" removes duplicates, if there are any. If that query doesn't work, post the error message here (and if possible, post the schema for your tables.  I've had to guess some parts of the query because I don't know what columns are where, and am not 100% sure which ones you want to match)
  9. Are you missing a break in your switch statement, above case "validate": ? In any case, you have nothing to lose by adding paranoid statements like "If (impossible condition) die("Something impossible happened!")".  You'd be surprised at how often something which should be impossible actually happens :)
  10. No you aren't mistaken. The only explanation I can think of is that your code which sets the $_SESSION variables is being called again.. Try adding a debugging statement like [code]echo "<br>Setting session variables for user {$row['id']}<br>";[/code] Then if that code gets run, you'll get a visual indicator on the page.
  11. I'm interested to see some var_dump()s of your $_GET, $_POST and $_SESSION .. surely there must be something different? When you say "filled with three NULLs", do you mean that the array $_SESSION['filters'][filter] exists, and each element has value null?  Or does has the array disappeared completely, resulting in any access to its elements returning null?
  12. There's no parse errors in that code snippet, or in the full code you posted earlier.. which leaves three alternatives (that I can think of) 1.  There's a syntax error in your current version of the file, but it occurs before or after the location it's reported.  This is often due to mismatched { and } 2.  There's a syntax error in a file included by your file (in include.php ?) 2.  You didn't save the file before testing (I have spent HOURS trying to fix bugs only to find I didn't save the file :D )
  13. Do you have a file global.php which is included at the top of all your php scripts? If so, I think the easiest solution is to have another file footer.php, which is included at the bottom of all your php scripts.  Defining the position to display is not straightforward (perhaps it can be done with CSS, but not with standard HTML)
  14. 5 digits?  That's a lot of digits :)  Try printing out those values further up as well.  Print them right after you set them, and after any statement that might possibly alter them.  If that doesn't work, then print the values out after statements which CAN'T possibly alter them :)  Sooner or later you'll find where it's going wrong. Oh.. I just noticed: [code]while ($icounts < $col) {[/code] [code]$icount++;[/code] Notice anything? :)
  15. stripslashes() is supposed to remove backslashes, not slashes.  Was your example supposed to be with a backslash? The manual says that the function's behaviour is affected by a configuration directive magic_quotes_sybase ( http://www.php.net/manual/en/function.stripslashes.php )
  16. mockenoff, can you post your current code?  Did you change the other places with incorrect incrementing, like '$counts = $counts++' and '$icount = $icount++' ?  They need to be changed too.  The simplest way to do it is just '$counts++' and '$icount++' To make debugging easier, try printing out the values of $icount and $col inside the while loop.  Do the same with the outer while loop.  THen maybe you can stare at it and it'll suddenly all makes sense :)
  17. You can do [code]SELECT date_format(date_test, '%a %D %b %Y') as formatted_date, cal_name, cal_time from webcal_entry[/code] It's good coding practice to specify which columns you want in a SELECT too.
  18. Nice colours and layout.. I'm at work so I'm not going to look any closer :)
  19. This looks a bit odd [code]$spot = $spot++;[/code] It should be one of these three: [code]$spot++; $spot = $spot + 1; $spot += 1;[/code] You might be getting infinite loops from that.  The semantics of $spot = $spot++ is "Increment $spot, then set $spot to be equal to the value before the increment."  Which boils down to "$spot = $spot". You might want to check the return value of opendir() as well.. but I doubt that's the problem, since the readdir() ought to fail if $fp isn't valid.
  20. Nearly every country has a zip code.. so that's an option. You could use a strategy like this - Match all longitudes and latitudes near the location of interest - Find all IPs which match those longitude/latitude combinations - Find all IPs from those which are in your database Seems a bit expensive.  But you can cache the results at various stages in your algorithm, meaning only the first request will have performance hit. Another option could be to store an 'IP block adjacency' look up table.  Then you can lookup immediately which IP blocks are adjacent to your IP block of interest.  It'll take a while to generate and it'll be big, but it'll be fast..
  21. Here are two options: [code]" LIKE '$c" . "media" . "'" " LIKE '{$c}media'"[/code] You can even do complex stuff like "{$arr['fortytwo'][5]}media'".  Those {} symbols are very handy :)
  22. I don't understand your question.  Can you give a bit more detail?
  23. That's a big project (for someone new to php).. I suggest you start out with some php tutorials (if you haven't already). For assigning the order numbers, you can get your database to do this.  If it's MySQL, use auto_increment  http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
  24. I can help you a little.. The function base64_decode() will decode that gibberish you see.  It needs to be called directly on the gibberish though, and not on the entire email. (notice the "Content-Transfer-Encoding: base64" - That tells you to use base64_decode on the text below) The rest of the format is called MIME.  I'm not aware of any PHP functions to decode that for you.
  25. Actually what I meant was this, right at the top of your php file (before ANY html at all, even blank spaces.. otherwise you can't modify the headers) [code]<?php header("Content-type: text/html") ?>[/code] If that's not the very first line in your file, it won't work.  You can have some php code before it, but no html. What that will do is it will modify the headers returned by the server.  This is different from the "meta" http-equiv tags, which tell the browser "Pretend you saw this header instead of the one you really saw" :) It's possible that firefox is treating the real header (which says your script is an octet stream) as more trustworthy than the meta http-equiv (which says your script is html), but explorer and safari are trusting the http-equiv.  If you can make the real header say "text/html" too, then that might fix it.  Of course IIS might ignore your header() instruction.. but it's worth trying. Good luck :) PS What the browser returns after an HTTP request is actually a series of headers (as in my earlier post), followed by the HTML.  Normally you never see those headers, because the browser reads them and interprets them but never displays them.
×
×
  • 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.