Re: How to execute multiples querys

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

 



On Wed, 2006-04-26 at 10:36, Mauricio Pellegrini wrote:
> On Wed, 2006-04-26 at 11:09, nicolas figaro wrote:
> > Mauricio Pellegrini a écrit :
> > >>> $quer1 = "SET @var1=3 ;
> > >>> 	SELECt * from table1 Where col1=@var1 " ;
> > >>>
> > >>>
> > >>> This gave a syntax error from MySQL inmmediately before the ";"
> > >>> (semicolon),
> > >>>
> 
> 
> > >>>       
> > did you try to run the query above
> > 
> > ( SET @var1=3 ; SELECt * from table1 Where col1=@var1 )
> > 
> > directly from a mysql client ?
> 
> Yes, I did and it Works perfectly.
> 
> 
> > perhaps the @ is interpreted and you have to put a \ before it.
> > try a print $quer1 once $quer1 is set.
> 
> I've tried this too. The output is sintactically correct.
> I even copied the output of the query and pasted it to Mysqlcc an
> executed it perfectly.
> 
> 
> 
> A few minutes ago I found that mysql_query() cannot execute more than
> one query at a time 
> so the form mysql_query("SET @var1=3 ; SELECT * from ....") is invalid 
> 
> 
> But the other way should work

Try explicitly retrieving a resource ID from mysql_connect, and
explictly use that resource when making the query. Probably not the
problem, but sounds like something is being lost from one query to
another.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
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