FROM array with no key:
$array = array('apple','bee','carrot','dragon','elephant')
To
$newarray = ($apple,$bee,$carrot,$dragon,$elephant)
Why: I want to create flexible function to get fields from a mysql db, like this:
<?php
$query = "SELECT ".$array." FROM table";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
extract($row);
echo $newarray;
}
?>
So I could:
- SELECT apple, bee, carrot and echo $apple, $bee and $carrot
- SELECT bee, carrot, elephant and echo $bee, $carrot, and $elephant
- or whatever.