Hello I have this code up to now
#issue query
$query1 = "SELECT ITEM_NAME FROM items_to_buy
ORDER BY ITEM_NAME ASC";
$result1 = mysql_query ($query1)
or die ("Cannot execute query");
$itemnamesdata = array();
while ($row = mysql_fetch_array($result1))
{
$itemnamesdata[] = $row[0];
}
for ($n = 0; $n < count($itemnamesdata); $n++)
{
$Line = each ($itemnamesdata);
print ("$Line[value].<p>\n");
}
mysql_free_result ($result);
And it works and gives me all the items in the column : item_name and prints them like so :
Widescreen VA
460W PSU
Router
DSLR Body
Winter Jacket
Smartphone
17-50MM F/2.8 LENS
Colormeter
Now how do I place each results into it's own unique variable?
I want to be able to call them separately like so:
$value1 = Widescreen VA
$value2 = 460W PSU
$value3 = Router
$value4 = DSLR Body
$value5 = Winter Jacket
$value6 = Smartphone
$value7 = 17-50MM F/2.8 LENS
$value8 = Colormeter
Thanks in advance !!!
\n"); ` in your while ?
– Benjamin Poignant Nov 26 '14 at 16:32