I'm having troubles using arrays. I don't know why, but my menu can't read my arrays...
I always receive this notice: PHP - Notice: Undefined offset: 0
function DB_array($query,$return_type){
connect();
$q = mysql_query($query);
switch ($return_type){
case 'a+':
$num_fields = mysql_num_fields($q);
$j=0;
$x = 0;
$val = array();
while($row = mysql_fetch_array($q)){
for ($j=0; $j < $num_fields; $j++){
$name = mysql_field_name($q, $j);
$val[$x][$name] = $row[$name];
}
$x++;
}
break;
Menu code
<?php
/*Return Type - Symbology
* //SELECT
* a+ | Data to array
*/
include(PATH_ROOT . '/modules/menu/view/menu_view.php');
function menuModel(){
$query = ("SELECT * FROM menu WHERE back = 1");
$val = DB_array($query,'a+');
$name = $val['0']['friendlyname'];
$url = $val['0']['url'];
menu($url,$name);
}
?>