I have a temporary table SQL. I have a filed that give me the name of the user that modified any information by get_current_user. I added another field type=DATETIME to recovre the date and the hour of the user modifcation.
In PHPI added it like all my function, but it got an error. The code is the following:
$sql = "INSERT INTO `...`.`correspondants_bis` (`code_client` , `name`, `surname` ,`phone`, `fax`, `email`, `added_by`, `Date`, `condition`) VALUES ('" . $correspondent->getCodeClient() . "', '" . str_replace("'", "''", $correspondent->getName()) . "', '" . str_replace("'", "''", $correspondent->getSurname()) . "', '" . $correspondent->getPhone() . "', '" . $correspondent->getFax() . "', '" . $correspondent->getEmail() . "', '" . $user . "','" . NOW() . "', '1' );"; the error is:
Fatal error: Call to undefined function..... Attempted to call function "NOW" from namespace.... I know that NOW() is an SQL function, just I got you an example of insert because I don't know how I add it, and this following my select function:
public function getCorrespondentByIdBis($id) { $statement = "SELECT * FROM `correspondants_bis` WHERE `id`='" . $id . "'"; $result = $this->_db->query($statement); while ($data = $result->fetch()) { $correspondent = new CorrespondentBis($data['id'], $data['code_client'], $data['name'], $data['surname'], $data['phone'], $data['fax'], $data['email'], get_current_user(), NOW(), 0); } } return $correspondent; } Can you tell me please, how I can change my code to resolve this issue ?