| Posted by J.O. Aho on 02/27/07 18:45 
kennthompson@gmail.com wrote:
 > No. That won't work either. I need to add one more thing. To make the
 > stable version work I had to identify the old table name as global. I
 > think this looks simpler than it really is. I thought a simple
 > variable name could be passed as a table name, but there must be some
 > mysql code that allows it.
 >
 
 Can you post the whole code you actually are using?
 
 for a code like
 
 function functionname($tablename) {
 $query="SELECT * FROM ".$tablename;
 $result=mysql_query($query);
 while($row=mysql_fetch_array($result))  {
 /* do what you do */
 }
 }
 
 will work fine, as long as the variable you use as an argument for the
 function does have a value and that there is a such table in your database.
 
 $thistable="a_table";
 functionname($thistable);
 
 --
 
 //Aho
  Navigation: [Reply to this message] |