Page 1 of 1

Loosing MySQL variable (@var)

Posted: Tue Jan 26, 2010 2:54 pm
by Pefo
How should I organize my queries to keep a MySQLs variable through multiple queries?

The value of my @varname turns to null between queries.

I LOCK the table
do a couple of queries (with the need of a persistant @varname)
UNLOCK the table

Is this normal MySQL behaivor or am I missing something?

Re: Loosing MySQL variable (@var)

Posted: Tue Jan 26, 2010 3:25 pm
by AbraCadaver
I'm pretty sure this isn't supported in the PHP extension for MySQL, and it isn't needed. You're using PHP, use PHP vars in the query. If you must have these then you can try using mysqli and your queries in a transaction.

Re: Loosing MySQL variable (@var)

Posted: Tue Jan 26, 2010 3:34 pm
by Pefo
Thanks.

Will have a look on your suggestions.