Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. You can: prepend all your paths with /. $_SERVER["DOCUMENT_ROOT"] is an absolute path to the root of your website... on the server. / is an absolute path to the root of your website... on the client.
  2. This topic has been... ugh, too tired to be creative... moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=356540.0
  3. And what did you try?
  4. For SELECTs, yes. No. mysql_fetch_*() will return false if there is no data to read. It will not error. I'm not being picky - I'm trying to correct statements that are flat-out wrong.
  5. Oh please. If by "no data to be returned" you mean "isn't SELECT, SHOW, EXPLAIN, or other type of query that creates resultsets" then yes. If you mean to include (executable) SELECTs that don't return any rows then no: mysql_query() will always return a resultset resource regardless of how many rows it found. Uh, no. OP: mysql_query() returned false because the query couldn't be executed. Print out the query and check for problems. There is probably something wrong with it.
  6. Good God man, WTF is up with that code?
  7. That's a rather paranoid approach to input validation. You really have to log it? What are you going to do with it, send a nasty letter? && has higher precedence than ||. If your condition had parentheses it'd look like (numeric $name) or (integer $name and numeric $surname) or (integer $surname) That's not what you want. I'd tell you to add parentheses but the facts are that form input is always a string and that is_int() checks the type of variable, not its contents. That means it will never return true for something from a form (eg, $_GET or $_POST). So just get rid of them. numeric $name or numeric $surname
  8. In IIS, change the application pool for your website to a classic ASP.NET pool. PHP isn't making use of integrated mode anyways.
  9. You can grab the first thing that looks like a number using value.match(/\d+(\.\d+)?/)[0]
  10. For some reason you're including form_functions.inc.php more than once. Don't do that. Easy way to avoid it is to use require_once().
  11. I personally like having parentheses around the whole thing because of how it looks (literally) to me. $firstName = (isset($_SESSION['memberFirstName']) ? $_SESSION['memberFirstName'] : ''); If you're not sure about the precedence thing then I recommend using the parentheses too, but ultimately it's up to your preferences and style.
  12. 1/2 and 3/4 are identical pairs. The parentheses around the condition mean nothing, but parentheses around the whole ternary could make a difference depending on operator precedence. $variable = $condition ? $a : $b; // equivalent to $variable = ($condition ? $a : $b) because ?: has higher precedence than = $variable == $condition ? $a : $b; // equivalent to ($variable == $condition) ? $a : $b because == has higher precedence than ?: Operator precedence table
  13. Yes, in that you can put any expression in the conditional part of a ternary operator. (For that particular code you'd want either isset() or !empty() but I don't think that's what you're asking about.)
  14. I've moved this from HTML Help. Now that you're here, check out the guidelines sticky and make sure you haven't missed out on anything important.
  15. This topic has been... screw it, "moved" to Website Critique. http://www.phpfreaks.com/forums/index.php?topic=356425.0
  16. Because ASP.NET does things differently than PHP, of course. If you cannot modify the form then you'll have to parse the query string or form data yourself. That's not fun. If you can then change the name to Code_value[] and $_POST["Code_value"] will be an array.
  17. PHP doesn't support multiple values from inputs with the same name. You will only get the last value as each one overwrites the previous value. You can, however, use arrays. Name your inputs like branch[] (yes, like PHP's array syntax) and $_POST["branch"] will be an array. You can use array keys too like branch[0] or branch[foo] if you wish but they're not required.
  18. Have you looked at the server error logs yet?
  19. There's no logging in that code you've just posted. So where is it happening? Outside the switch? If you have it happen after then you can set some flag in the default case like $hit_default = true; and check for that when you log whatever.
  20. You can have a case cascade into a default. case 'DEFAULT_CATCHALL_ERROR_CODE_9999': default: // code
  21. This topic has been rewritten to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=356324.0 (have I used that one before? I need to write these down somewhere)
  22. I was wondering whether you recognize it. Maybe it was one of the items that you deleted earlier.
  23. The output in the screenshot doesn't match up with the code you've posted.
  24. Good. Because now I'll tell you that there's a syntax error in your query. And with what Muddy told you to do, you should be able to see where it is.
×
×
  • 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.