Forum Moderators: coopster

Message Too Old, No Replies

PHP recordset Array

         

davidmj

10:43 am on Jun 13, 2005 (gmt 0)

10+ Year Member



Hi Guys
Can anyone help with this

I am passing (submiting) the following values to a report page from a textfield called ..(sqlvar)


input name="sqlvar" type="hidden" value= ...

$row_recordset['field1']¦$row_recordset['field2']¦$row_recordset['field3']¦$row_recordset['field4']

...........

these are in one hidden field as you see above and the length can change dynamically

//i am using the following on the receiving page


$sqlvariable = $_POST['sqlvar'];

$sqlvariable =stripslashes($sqlvariable);

if ($sqlvariable!=''){

$strarray2 = explode('¦',$sqlvariable );
$carray = count($sqlvariable);

for ($i=0; $i < $carray; $i++){

$td2 = $td2.'<td><?php echo'.$strarray2[$i].'?></td>';

}

how can i proccess $strarray2[$i] as the var $row_recordset['fields']from the database

mcibor

1:49 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is the length always the same?

Then you can use rekeying the array, or just remember which value is which key.

BTW you can implode the $row_recordset as you then explode it.

To preserve the keying you would have to make another hidden with just the keys, and then connect those two arrays into keys=>values. Have a look into www.php.net or ask here and then I'll write more how to do that.

If it's not the problem, then please explain what do you mean by: how can i proccess

Michal CIbor