EEEtc
1
Hello
How can I do this? Is the following correct?
$quoteCell = array ("$product", "$item")
The $row is an associative array with mixed keys, number and assoc
while ($row = mysql_fetch_array($QueryProduct, MYSQL_BOTH)) {
foreach ($quoteCell as $value){
$ff=substr( $value, 1 );
[B]$htmlr .= '<td>' . $row[$ff] . '</td>';[/B]
}
}
The above does not work. Basically, I want it to be like:
$row[$ff] <> $row['product']
This will read the results into an array:
$products=array(); // Set $products as an empty array
while ( $row = mysql_fetch_array($QueryProduct, MYSQL_BOTH)) {
$products[]=$row;
}
Then you use a foreach loop to do something with each row of the array.
foreach ( $products AS $product ) {
// code to do something with each product
// values will be like for example $product['name']
}
Each row of the array will be a sub-array, which will contain the values for each field. To help understand after using the while loop, add:
echo '<pre>';
var_dump($products);
echo '</pre>';