Ajmal Salim
New member
Hi,
I am trying to fetch some data from the database and I need to return an array like this :
I am doing something like this :
Unfortunately I am getting an error :
Note : Line 11 is
I am trying to fetch some data from the database and I need to return an array like this :
Code:
Array (0=>'Snapdeal',1=>'Flipkart',)
I am doing something like this :
PHP:
public static function getFeaturedStores()
{
$array = array();
$db = XenForo_Application::get('db');
$query = $db->fetchAll("SELECT store_id, store_name FROM xf_stores WHERE store_featured = '1' ORDER BY store_name");
foreach($query AS $key => $value)
{
$array[$key] = $value;
}
return $array;
}
Unfortunately I am getting an error :
Code:
Parse error: syntax error, unexpected '$query' (T_VARIABLE) in /home/abc/public_html/discuss/library/Stores/ThreadList/Manager.php on line 11
Note : Line 11 is
Code:
$query = $db->fetchAll("SELECT....