Welcome Guest, Not a member yet? Register   Sign In
You have an error in your SQL syntax
#1

[eluser]Unknown[/eluser]
Goodnight everyone, i'm a newbie. and i want to ask something about the mySql syntax in code igniter. i have a problem searching what's wrong with my program. I tried using model poll_model :

Quote:class poll_model extends CI_Model{

function __construct()
{
parent::__construct();
}
function tampil_soal()
{
$q = $this->db->query("SELECT * FROM tbl_pollingsoal WHERE status='Y' ");
return $q;
}
function tampil_jawaban($id)
{
$q = $this->db->query("SELECT * FROM tbl_pollingjawaban WHERE id_soal='$id' ");
return $q;
}
function simpan_poll($id)
{
$q = $this->db->query("UPDATE tbl_pollingjawaban SET counter=counter+1 WHERE id_jawaban=$id ");
}
}

but when i click the vote button. they always ended like this. Sad

Quote:A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

UPDATE tbl_pollingjawaban SET counter=counter+1 WHERE id_jawaban=

Filename: C:\xampp\htdocs\grafik\system\database\DB_driver.php

i didn't know where the fault is.




Theme © iAndrew 2016 - Forum software by © MyBB