[CS-FSLUG] Perl and DBD::MySQL

Timothy Butler tbutler at ofb.biz
Fri Jul 1 19:19:58 CDT 2005


I'm going crazy. Is there anyway that anyone knows of to send  
multiple MySQL queries within one "execution" of DBD::MySQL? I want  
to set a MySQL variable (e.g. "SET @num=0;") before doing the main  
query. I tried to do this:

     SET @num=0;UPDATE mypage SET mypageorder=(@num:=@num+1) WHERE  
uid=1030 ORDER BY `mypageorder`;

     However, Perl does not seem to allow me to include those two  
"queries" at the same time. If I do not explicitly set @num, however,  
the value returned in the UPDATE query is NULL, since @num has not  
been declared previously. Any ideas?

     Thanks,
         Tim

---
Timothy R. Butler | "Turning and turning in the widening gyre
tbutler at ofb.biz   |  The falcon cannot hear the falconer;
timothybutler.us  |  Things fall apart; the centre cannot hold;
uninet.info       |  Mere anarchy is loosed upon the world..."
                                                 -- W. B. Yeats





More information about the Christiansource mailing list