• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Messages In This Thread
You have an error in your SQL syntax - by El Forum - 01-08-2012, 09:27 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.