Re: How to execute multiples querys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, April 26, 2006 11:07 am, Martin Alterisio wrote:
> You should be able to do this in two calls to the mysql_query()
> function.
> mysql_query("SET @var1=3");
> mysql_query("SELECT * from table1 Where col1=@var1");

-bash-2.05b$ php -a
Interactive mode enabled

<?php
mysql_connect('localhost', '***********', '********************');
mysql_select_db('**********');
mysql_query("SET @var1 = 3") or print(mysql_error());
$result = mysql_query("SELECT @var1") or print(mysql_error());
print_r(mysql_fetch_row($result));
?>
X-Powered-By: PHP/4.4.1
Content-type: text/html

Array
(
    [0] => 3
)
-bash-2.05b$

Yup.

Definitely works.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux