Re: How to execute multiples querys
| From: | Richard Lynch | Date: | Wed, 26 Apr 2006 21:43:13 +0000 |
| Subject: | Re: How to execute multiples querys | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234876@lists.php.net to get a copy of this message | ||
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