这是我的数组:
$data = array(
'user_id' => $profile_data['user_id'],
'sender_id' => $session_user_id,
'sender_first_name' => $user_data['first_name'],
'photo_url' => 'null',
'time' => time(),
'status' => $_POST['status']
);
这是我的功能:
function post($data) {
array_walk($data, 'array_sanitize');
$fields = '`' . implode('`, `', array_keys($data)) . '`';
$data = '\'' . implode('\', \'', $data) . '\'';
mysql_query("INSERT INTO status ($fields) VALUES ($data) ");
if ($data['sender_id'] == 1) {
//code
}
}
例如,如何检查 'sender_id' 的值是否为 1?