Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Posts
    1

    Unanswered: Massive issues with Oracle using PHP

    I am having trouble trying to get this query to work... what is wrong?

    SELECT ACTION_CODE ACTION_CODE,ACTION_LEVEL ACTION_LEVEL,ACTION_MASTER ACTION_MASTER FROM ( SELECT alias.ACTION_CODE,alias.ACTION_LEVEL,alias.ACTION_ MASTER, rownum r FROM ( SELECT ACTION_CODE,ACTION_LEVEL,ACTION_MASTER FROM ACTION_CODES ORDER BY ACTION_CODE ) alias WHERE rownum <= ? ) WHERE r > ?

    Warning: ociexecute() [function.ociexecute]: ORA-00911: invalid character in /usr/local/apache2/htdocs/robtest/feed26.php on line 808
    0 - CHECK
    Results

    Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in /usr/local/apache2/htdocs/robtest/feed26.php on line 828

    Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in /usr/local/apache2/htdocs/robtest/feed26.php on line 844
    has this value


    here is the code... please reply back soon.

    Code:
    if($dbs[0][1]=="EBS" || $dbs[0][1]=="HRMS")
    			{							
    				$sql  = "SELECT $fldso";
    				$sql .= " FROM ( SELECT $alias_flds, rownum r";
    				$sql .= " FROM ( SELECT $flds_b";
    				$sql .= " FROM $k";
    				$sql .= " ORDER BY $indxflds"; 
    				
    				//if scalar @idx_key > 0;
    				$sql .= " ) alias WHERE rownum <= ? )"; // $recs_page
    				$sql .= " WHERE r > ?";                 // $recs_start		
    			}	
    			elseif ($dbs[0][1]=="CELCAT")
    			{
    				$sql  = "SELECT $flds_b";
    				$sql .= " FROM (SELECT TOP ? $flds_a"; // $recs_page
    				$sql .= " FROM (SELECT TOP ? $flds";   // $recs_end
    				$sql .= " FROM $k";
    				$sql .= " ORDER BY $indxflds_ord"; 
    				
    				//if scalar @idx_key > 0;
    				$sql .= ") AS A";
    				$sql .= " ORDER BY $indxflds_a" ;
    				
    				//if scalar @idx_key > 0;
    				$sql .= ") AS B";
    				$sql .= " ORDER BY $indxflds_b"; 
    				//if scalar @idx_key > 0;
    			}	
    			
    			echo'<p><b>SELECTION SQL FOR GRABBING DATA</b></p>';
    			echo'<p>'.$sql.'</p>';
    
    			unset($fldso);
    			unset($alias_flds);			
    			unset($flds_b);
    			unset($indxflds);		
    			
    																
    						//$sql="SELECT * FROM $k LIMIT 0,3"; //currently limiting data results...
    						
    						
    								$numr=ociparse($c,$sql);
    								
    								
    								ociexecute($numr);
    								
    								$check_num_records = ocinumcols($numr);
    								
    								echo''.$check_num_records.' - CHECK';
    								//pull out the number of records.
    								
    								echo'<br/>Results<br/>';
    							
    								//if($check_num_records==0)
    								//{
    								//	echo'Currently, there is nothing in '.$k.'.',"\n";
    								//}
    								//else
    							//	{			
    								
    				
      
    
    
    while ($row = oci_fetch_array ($numr, OCI_BOTH)) {
       echo $row[0]." and ".$row['ID']." is the same<br>";
       echo $row[1]." and ".$row['NAME']." is the same<br>";
    }          
                
                
                
                
                
                
                
                
                
                
                					
    									//FETCH RESULTS FROM FOREIGN DATABASE!	
    									while ($row = oci_fetch_array($numr, OCI_BOTH))
    									{
    										echo'BIG TEST WOOOOOO HOOO '.$row[0].'<br/>';
    										echo'BIG TEST WOOOOOO HOOO '.$arr[0].'<br/>';
    										
    										if($sql_mode==1)
    										{
    											$real_results[$m]= $row; //place ONLY SQL mode 1 results from table into array
    										}
    										
    										
    										
    										for($i=0;$i<=$n-1;$i++)
    										{
    											$trv.="'$row[$i]', ";  // a,b,c, - this makes a string with the results for each coloumn it finds... col1, col2, col3,
    										}
    										$trv =substr($trv,0,-2); //remove the comma from the last variable
    										$trv = "($trv)";	// (a,b,c) - these results are placed into this format then put into an array.
    										$mass_result[] = $trv;	
    										unset($trv);	
    									}		
    									
    									echo''.$row.' has this value';

  2. #2
    Join Date
    Dec 2003
    Posts
    1,074
    Can you run that query in SQL*PLus?

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I am not very big on PHP, but where do you define the parameters for the query?

    And which branch of the if statement is being executed here?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •