So I'm using x-editable for bootstrap, which is awsome for me.
With that, to return a menu for selection one needs to return an array as such to make it work:
$arr = array(
array('value' => 'Male', 'text' => 'Male'),
array('value' => 'Female', 'text' => 'Female'),
);
It's fine if you have to write it, but now I need to make this array from database output.
So for instance if I run a "while($row" loop, how is the output going to be an array like that. This is what I'm trying, but oviously failing at cause this is not working:
$query = 'SELECT id,app_name FROM apps';
$result = mysql_query($query) or bomb($s,509,addslashes($query),addslashes(mysql_error()));
if(mysql_num_rows($result) > 0) {
while($row = mysql_fetch_assoc($result)) {
$arr .= Array(
Array('value' => $row['id'], 'text' => $row['app_name']),
);
}
}
It's probably a silly question, so thanks in advanced.