Re: global var.
| From: | Sebastian | Date: | Tue, 01 Apr 2003 03:59:59 +0000 |
| Subject: | Re: global var. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141775@lists.php.net to get a copy of this message | ||
Hmm, interesting.. i dunno why it doesn't work for me, here is a bit of the
code, $var isn't getting the output of $id, any ideas?
$var = &$id;
if( ! $forg = resizer_main("image","image_$var", blah, blah........");
$org = getimagesize( "$root/$forg" );
$result = @mysql_query("INSERT INTO images blah blah.....");
$id = mysql_insert_id();
cheers,
Sebastian
----- Original Message -----
From: "Marcus Rasmussen" <mr@gate58.dk>
Putting an & sign in front of the $id in the first line should do the trick:
$variable = &$id;
A short example:
$bar = 0;
$foo = &$bar;
$bar = 2;
print $foo; //prints 2
______________________
Marcus Rasmussen
mr@gate58.dk
www.marcusr.dk
-------------------------------------------------------------
On 31-03-2003 at 19:56 Sebastian wrote:
-------------------------------------------------------------
hello all,
$variable = $id;
// some other stuff....
@mysql_query here....
$id = mysql_insert_id();
to the question: How do I get $id from insert_id() to pass to $variable
above? Hard to explain the situation i am in, but the query has to be below
$variable, is it possible to 'globalize' $id so it passes to the top
$variable?
first time i ever ran into this problem.
Thanks in advanced.
cheers,
- Sebastian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php