php - Code Works on Server not on Xampp: json_encode -
hi have piece of code works on uberspace server doesn't work on xampp (mac).
the code database request:
get_all_experts($errors, $rows, ' active < curdate() , active not null'); echo count($rows);//is 14 in example echo json_encode($rows);//doesn't return $arr = array (1,'b'=>'2','c'=>3,'d'=>4,'e'=>5); echo json_encode($arr);//works function get_all_experts(&$errors, &$rows, $selector) { $result = mysql_query('select * experts'.$selector); if (!$result) { $errors['sql_experts'] = 'kein ergebnis: '.mysql_error(); } else { while($r = mysql_fetch_assoc($result)) { $rows[] = $r; get_expert_tags($errors, $rows, $r); get_last_expert_experience($errors, $rows, $r); } } };
the 2 inner functions database requests , add nested values. e.g. 1 expert has more 1 experience.
edit:
$conn = mysql_connect('localhost', 'blub', 'mysecretpassword') or exit(mysql_error()); mysql_select_db('blab', $conn) or exit(mysql_error()); mysql_query("set names 'utf8'"); mysql_query("set character set 'utf8'");
Comments
Post a Comment