|  | Posted by Mike Smith on 04/27/05 23:29 
I have a form where I can submit a Query to be run against a MSSQL 2000 Server.The query is stored correctly in a text (DataType) column. I can
 retrieve it echo it back to the screen, copy-n-paste into Query
 Analyzer and the query works.
 
 What I cannot do is get the query to be returned from the recordset
 and used to build a new recordset. Confused?
 
 function preview_report(){
 //Get the query
 $s = "SELECT rptsql \n";
 $s .= "FROM rpt_mas\n";
 $s .= "WHERE id={$_POST['frm_rptid']}\n";
 $r = $this->db->Execute($s);
 $r_arr = $r->GetArray();
 $sql1 = $r_arr[0][0]; //I can echo this to the screen and run
 it in Query Analyzer
 $sql2 = "SELECT id, rptname, rptdesc, rptfile, rpttype,
 rptsql FROM rpt_mas";
 
 if($sql!=""){
 $this->xq = $sql;
 $r = $this->db->Execute($sql1);//This doesn't work
 $r = $this->db->Execute($sql2);//This does work
 }
 }
 
 $sql1 & $sql2 are one and the same. Any ideas what I'm missing?
 
 Thanks,
 Mike Smith
 [Back to original message] |