Page 1 of 1
dataset blues...
Posted: Wed Nov 20, 2002 3:35 pm
by lo-fi
Code: Select all
$result=mysql_query("select * from mydata order by 'id'")or die('died');
$num_rows = mysql_num_rows($result);
$j=0;
$x=1;
while($row=mysql_fetch_array($result)){
for($j=0;$j<$num_rows;$j++){
$name = mysql_field_name($result, $j);
$objectї$x]ї$name]=$rowї$name];
}$x++;
}
Later in the script I use the below array to gain access to my data
Code: Select all
$i=1;
$ii=count($object); //quick access function
for($i=1;$i<=$ii;$i++){
echo $objectї$i]ї'your_field_name'];
}
i got this from php.net manual
but
i need to output
&row0=$article__2|aaaa|tipo 1:&row1=art2|bbbbb|Tipo 2: <-this
any idea?
Posted: Wed Nov 20, 2002 10:28 pm
by volka
unsure wether I got the point but you may try something like
Code: Select all
$result=mysql_query("select * from mydata order by 'id'")or die(mysql_error());
$row_num = 0;
while( $row = mysql_fetch_row($result) )
echo '&row', $row_num++ , '=', implode('|', $row), ':';
(completely untested, not even by compiler

)
Posted: Thu Nov 21, 2002 5:13 am
by lo-fi
hey thanx for the answer,
Code: Select all
function output_data(){#prints the variables to flash, that will then parse them into an array
$output = "";
$i=1;
$ii=count($object); //quick access function
for($i=1;$i<=$ii;$i++){
$output .= "row".$i."=".$this->recieved_dataї$i]ї$this->fieldsї$i]].":";
}
something like this,
because i cannot hardcode my field names, because it's all dynamic!
&row0=$article__2|aaaa|tipo 1:&row1=art2|bbbbb|Tipo 2:
is what i need to output to flash so i can parse them properly there.
thx!