Simple Query(1 column) to array to variables (not simple to me )
Hello,
I need just a little push and as i'm new at arrays it would really be helpfull.
I need to get variables with data coming from a simple sqlquery , my sql query returns datas as
product1
product2
product3
...
i can't seem to get
var1 = product1
var2 = product2 ...
all i can do is echo them in a loop but no usable variable.
here is my "cleared" code so far:
Code:
<?php
$query = "SELECT `produits`.`nom_prod` FROM `selectmem` Inner Join `produits` ON `selectmem`.`bon1` = `produits`.`id` OR `selectmem`.`bon2` = `produits`.`id` OR `selectmem`.`bon3` = `produits`.`id` ";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo $row['nom_prod'];
echo "<br />";
}
echo "THE_END";
?>
my loop works and gets the datas but how to get datas to as many variables?
$var1, $var2 etc..
This or going directly from query to variables of course
thanks for your help