Title kind of says it all, im paying 3 variables through function insertannounce and the database is throwing back an error: Fatal error: Cannot pass parameter 4 by reference.
fyi: id is not auto increment and date is a string.
requested info: php
for ($j = 0; $j < count($server_id); $j++){
$found = 0;
if (isset($local_id[0])){
for ($i = 0; $i < count($local_id); $i++) {
if ($server_id[$j] == $local_id[$i]){
$found = 1;
}
}
if ($found == 0)
insertAnnounce($server_id[$j], $server_message[$j], $server_date[$j]);
}
else //if both fields are empty
insertAnnounce($server_id[$j], $server_message[$j], $server_date[$j]);
}
function:
function insertAnnounce ($id, $message, $date){
// $insert = $mysqli->query("INSERT announce (id, message, active, datestamp) VALUES ('{$id}', '{$message}', 'enabled', '{$date}')");
if ($stmt = $mysqli->prepare("INSERT INTO announce (id, message, active, datestamp) VALUES (?, ?, ?, ?)"))
{
$stmt->bind_param("isss", $id, $message, 'enabled', $date);
$stmt->execute();
$stmt->close();
}
}
any ideas?, thanks!