Jump to content

trevorsg

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by trevorsg

  1. Ah, I was just looking for that part of the manual, and I couldn't find it. What is the reasoning behind this? Ooh, I just had a thought - it's that way so you can do something like $blah = doSomething() or die("Can't do something"); Ok, makes sense now.
  2. Try running the following code: var_dump(true and !true); $var = true and !true; var_dump($var); Was the output the same as what you expected? Now try putting parentheses around the `true and !true` in the second line. The problem is fixed. You can also replace `and` with `&&` and the problem is fixed as well. Is this a bug in PHP? Is the `and` operator purposefully given a weaker precedence than the assignment operator? Any light on this subject would be greatly appreciated. Thanks!
  3. Here's another way: function get_params() { unset($_GET); //Frees up some memory $uri = explode('?', $_SERVER['REQUEST_URI']); $queryStr = $uri['1']; $vars = explode('&', $queryStr); $getVars = array(); foreach ($vars as $var) { $exp = explode('=', $var); $getVars[$exp[0]] = $exp[1]; } return $getVars; } And then you can use it to make any variable contain an array with your get variables! $some_var = get_params(); //your 'tester1' can be accessed by $some_var['table'] I know the above works because I read it on 4chan.
  4. Random number + id won't produce a unique ID (in other words, it's just as "random" as a regular random number). You might want to use http://us2.php.net/manual/en/function.uniqid.php to generate a unique ID. At any rate, you can access the ID of the new record that was saved with $this->Invoice->id. If you want to run two queries on every save that's your choice.
  5. You can also use the date function... echo date('l, f j, Y g:i a', strtotime($time));
  6. You can select it with JavaScript... JS: document.getElementById('selectId').value = "<?php echo $_POST['dob_year'];?>";
×
×
  • 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.