I'm really stuck with this issue and hope someone can help me to break of it..... I have a table called result and the column is as followed.
Name q1 q2 q3 q4 q5 q6 q7 q8 q9
Mike a b c d e f a c d
James c d e e a b d d c
My current script is as follow:
$sql="select * from resulttest where Name = Mike ";
$result1 =$objconn->execute($sql);
$recordcount = $result1->getNumOfRows();
$i=1;
while (!$result1->EOF) {
$q1=$result1->fields['q1'];
$q2=$result1->fields['q2'];
$q3=$result1->fields['q3'];
$q4=$result1->fields['q4'];
$q5=$result1->fields['q5'];
$q6=$result1->fields['q6'];
$q7=$result1->fields['q7'];
$q8=$result1->fields['q8'];
$q9=$result1->fields['q9'];
$i=$i+1;
$result1->nextRow();
}
My question is , is there any idea that I can use array to retrieve the value from the database. If I have the column from q1 to q50, then I have to list the $result1-> until 50 times..... Hope can I use ( something like $i value in array to retrieve the data? ) Anyone knows? I tried n guess something below... but doesn't work..... How can I do that!!!!
$i=0;
$sql="select * from resulttest where Name = Mike ";
$result1 =$objconn->execute($sql);
$recordcount = $result1->getNumOfRows();
$i=1;
while (!$result1->EOF) {
$q.$i=$result1->fields['q$i'];