php error
Forgive me first time coding in php. I am trying to export data from drupal to a json file.
After research i should be missing "}] or something but i cannot find it in line 9 or 10.
Line 10 is
$items['message/json'] = array(
The error is:
Parse error: syntax error, unexpected T_VARIABLE in line 10
<?php
/**
* Implementation of hook_menu()
*/
function message_menu(){
$items = array();
$items['message/json'] = array(
'title' => 'Json callback',
'page callback' => 'message_json_page',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
*json call back
*/
function message_json_page() {
$sql = “SELECT n.nid , n.title as name, b.body_value as message FROM {node} n INNER JOIN {field_data_body} b ON n.nid = b.entity.id WHERE n.status = 1 and n.type = :type”
$result = db_query($sql, array(�?:type’ => �?message’))->fetchAll();
$json_value = json_encode($result);
print $json_value;
}
;
for$sql
and you are using curly quotes“
/�?
instead of standard quotes"
/'
in$sql
and$result