Re: Am I asking too much?
| From: | John Taylor-Johnston | Date: | Sat, 11 Oct 2003 00:21:18 +0000 |
| Subject: | Re: Am I asking too much? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165817@lists.php.net to get a copy of this message | ||
So I should break it up my two queries?
$sql = 'insert into '.$db2.'.'.$table2.'(KW,AUS,GEO,AN,RB,CO,RR)
select KW,AUS,GEO,AN,RB,CO,RR FROM '.$db.'.'.$table.'
WHERE id='.$id.';';
mysql_query($sql);
$sql = 'DELETE FROM '.$db.'.'.$table.' WHERE id='.$id.' LIMIT
1;';
mysql_query($sql);
Any suggestions how I could prompt in between to ask yes or no? PhpMyAdmin does it with a javascript
alert(). An easy answer? Maybe I'm being lazy?
John
> For security reasons mysql_query does not support ; to separate queries.
> phpmyadmin splits multiple query strings up (PMA_splitSqlFile())
>
> John Taylor-Johnston wrote:
> > $sql1 works, but $sql2 doesn't. Am I asking too much? :=)
> > $sql2 echoes ok. If I copy it and run it in phpmyadmin, it works, but this way as php
> > code, it flunks out when I add:
> >
> > DELETE FROM '.$db.'.'.$table.' WHERE id='.$id.' LIMIT 1;
> >
> > Ideas?
> > John
> >
> > ------------ snip -----------------
> > $sql1 = 'insert into '.$db2.'.'.$table2.'
> >
> > (RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR)
> > select
> >
> > RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR
> > FROM '.$db.'.'.$table.'
> > WHERE id='.$id.';';
> >
> > mysql_query($sql1);
> >
> > ------------ snip -----------------
> > $sql2 = 'insert into '.$db2.'.'.$table2.'
> >
> > (RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR)
> > select
> >
> > RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR
> > FROM '.$db.'.'.$table.'
> > WHERE id='.$id.';
> > DELETE FROM '.$db.'.'.$table.' WHERE id='.$id.' LIMIT
> > 1;';
> >
> > mysql_query($sql2);