I'm trying to retreive multiple result and using them. I have tried to pass the results to and array but PHP doesn't like it to much.
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, array given in C:\PHP\includes\.... on line 21
[SOLVED] Working with multiple resultsets simultatiouly
Moderator: General Moderators
please help!
Code: Select all
<?php
class result{
var $db;
var $connect;
var $result;
function result(&$connect){
include("globals/Sianda_glb_conn.php");
$this->connect = $connect;
$this->db = $dbName;
}
function pages ($whereValue = "%",$page_requested,&$result,&$fieldName){
$debug = 0;
include("class/Select/scripts.php");
$sql = new scripts();
$debug = 0;
switch($page_requested){
case "MemProd":
$this->result=mysqli_query($this->connect,$sql->Mem_List_script($whereValue)) or die("Invalid Query".mysql_error());
$resultї0] = $this->result;
$this->result=mysqli_query($this->connect,$sql->Mem_Address_script($whereValue)) or die("Invalid Query".mysql_error());
$resultї1] = $this->result;
$nRows=mysqli_num_rows($this->result);
$numFileds = mysqli_num_fields($this->result);
$fieldInfo = mysqli_fetch_fields($this->result);
for($i=1; $i<$numFileds; $i++){
$fieldNameї$i] = $fieldInfoї$i]->name;
}
if ($debug != 0){
echo "result numbers: ".count($result)."<br>";
echo "Connection: {$this->connect}";
echo "<br> Numbers of Fields: {$numFileds}<br>";
echo "Number of Rows: {$nRows}<br>";
}
if ($debug != 0){
echo "MemProd";
echo "{$sql->Mem_List_script($whereValue)}<br>";
}
break;
if(count($result) == 1){
$nRows=mysqli_num_rows($this->result);
$numFileds = mysqli_num_fields($this->result);
$fieldInfo = mysqli_fetch_fields($this->result);
for($i=1; $i<$numFileds; $i++){
$fieldNameї$i] = $fieldInfoї$i]->name;
}
if ($debug != 0){
echo "Connection: {$this->connect}";
echo "<br>Numbers of Fileds: {$numFileds}<br>";
echo "Number of Rows: {$nRows}<br>";
}
}
}
}
?>getting the recordset from a switch
Code: Select all
<?php
function vertical_display($result_num = 0,$page){
include_once("class/html/html.php");
include_once("class/select/results.php");
$sql_class = new result($connect,$page);
$html = new html();
$whereValue ='%';
$sql_class->pages($whereValue,$page,$resultї$result_num],$fieldName);
for($a=0; $a < count($resultї$result_num]);$a++){
$html->open_table("100%");
$html->open_table_row();
echo $resultї$result_num];
while($row=mysqli_fetch_array($resultї$result_num])){
for ($i=1; $i <= count($fieldName);$i++){
$html->open_table_row();
$html->open_table_data($fieldNameї$i],"","1","tblhead");
$html->close_table_data();
$html->open_table_data($rowї$i],"","1","tbldata");
$html->close_table_data();
$html->close_table_row();
}
$html->open_table_row();
$html->open_table_data("b","0%","");
$html->close_table_data();
$html->close_table_row();
#echo "FieldName: {$fieldNameї$i]}";
}
$html->close_table_row();
$html->close_table();
}
}
?>All this works well if you are using one recordset only.
problem solved
I fixed it a the place where I call the diferent results Thank you in any case.