thx kennethtucker,
  i'm using php 5 , the problem is solved it was because of the  "" & '
while calling the procedure.

On 10/31/06, kennethtucker <[EMAIL PROTECTED]> wrote:
>
>
> What version of php are you using?
>
>
> --- In [email protected] <php-list%40yahoogroups.com>, "Gayatri" <
> [EMAIL PROTECTED]> wrote:
> >
> > i've a sql query as follows:
> >
> > SELECT tb1.col1,tb2.col1,tb3.col1 FROM tb1,tb2,tb3 where
> > tb1.col1=tb2.col2 AND tb3.col3=tb2.col3 AND tb2.col4 BETWEEN 4 AND 5
> > AND tb2.col5 BETWEEN 6 AND 7;
> >
> > if I run the above query thru php it works, but if i try to call a
> > procedure for above query as shown below it thrws error
> > ERROR 1064 (42000): the right syntax to use near 'tb1.col2
> > <?
> > $wherestr = "tb2.col4 BETWEEN 4 AND 5 AND tb2.col5 BETWEEN 6 AND 7";
> > CALL proc4($wherestr);
> >
> > ?>
> > Procedure#=>
> >
> > DELIMITER $$
> >
> > DROP PROCEDURE IF EXISTS `dbname`.`proc4`$$
> > CREATE [EMAIL PROTECTED] PROCEDURE `proc4`( whereval varchar(500))
> > BEGIN
> >
> > set @whereval = whereval;
> >
> >
> > set @sql1 = CONCAT('SELECT tb1.col1,tb2.col1,tb3.col1 FROM
> > tb1,tb2,tb3 where tb1.col1=tb2.col2 AND tb3.col3=tb2.col3 AND
> > ',@whereval);
> > PREPARE stmt FROM @sql1;
> >
> > EXECUTE stmt using @whereval;
> > DEALLOCATE PREPARE stmt;
> >
> >
> > END$$
> >
> > DELIMITER ;
> >
> > what is the error in above code?
> >
>
>  
>


[Non-text portions of this message have been removed]



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to