I has tried the “TEXT” without ’ can works,
but now i using [color="#00FFFF"]bindParam[/color] to fix the ’ but came out error.
Do you guys know where is the problems?
public function actionAdd() {
if ($_POST) {
$nama = $_POST['nama'];
$alamat = $_POST['alamat'];
$telp = $_POST['telp'];
$sql = "INSERT INTO pegawai (nama,alamat,telp)
VALUES('$nama','$alamat','$telp')";
$connection = Yii::app()->db;
$command = $connection->createCommand($sql);
$command->bindParam(":nama",$nama,PDO::PARAM_STR);
$command->bindParam(":alamat",$alamat,PDO::PARAM_STR);
$command->bindParam(":telp",$telp,PDO::PARAM_STR);
$command->execute();
$this->redirect(array(
'indexpegawai')
);
}
$this->render('add');
}
The error message show below :