473,326 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

error...right syntax to use near '=1WHERE id_poll='1'' at line 1

4
I'm newbie and I had a problem on my SQL syntax like this 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 '=1WHERE id_poll='1'' at line 1
The following below is my php code
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include "inc.koneksi.php";
  3. $IdDataH =$_POST['IdDataH'];
  4. $Rbpilih =$_POST['Rbpilih'];
  5.  
  6. $poll_sql ="SELECT * FROM polling WHERE id_poll='$IdDataH'";
  7. $poll_qry =mysql_query($poll_sql, $konek)
  8. or die ("Gagal menampilkan".mysql_error());
  9.  
  10. $poll_data =mysql_fetch_array($poll_qry);
  11.  
  12. switch ($Rbpilih){
  13.     default :
  14.     $hasil=$poll_data['hasil_a']+1;
  15.     $jawab="hasil_a=$hasil";
  16.     break;
  17.     case 'a' :
  18.     $hasil=$poll_data['hasil_a']+1;
  19.     $jawab="hasil_a=$hasil";
  20.     break;
  21.     case 'b' :
  22.     $hasil=$poll_data['hasil_b']+1;
  23.     $jawab="hasil_b=$hasil";
  24.     break;
  25.     case 'c' :
  26.     $hasil=$poll_data['hasil_c']+1;
  27.     $jawab="hasil_c=$hasil";
  28.     break;
  29. }
  30.  
  31. $poll_sql2 ="UPDATE polling SET".$jawab."WHERE id_poll='$IdDataH'";
  32.  
  33. $poll_qry2 =mysql_query($poll_sql2, $konek)
  34. or die ("Gagal menampilkan".mysql_error());
  35.  
  36. include "index.html";
  37. ?>
  38.  

can anyone have a solution about this problem ?
May 2 '11 #1
3 2281
TheSmileyCoder
2,322 Expert Mod 2GB
Line 31, insert a space after the SET and before the WHERE, would be my guess.
May 2 '11 #2
qdoet
4
've tried as your suggestion but still can not.

please tell me what I should do anymore ?
May 2 '11 #3
Dormilich
8,658 Expert Mod 8TB
post the new error message. the mentioned missing space was clearly the one causing this error.
May 3 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
6
by: martin1 | last post by:
I just use DataSet to bind DataSetGrid and display from SQL DB. when starting run in Visual Studio 2005, get "Line 1: Incorrect syntax near '1'" error message from below fill line, ...
1
by: beary | last post by:
Could someone please tell me what's wrong with the code below. It worked fine the first time, then I cleared the table (results) and tried it again, but got the message "You have an error in your SQL...
1
by: iporter | last post by:
In the following code, the two Response.Write statements output exactly the same - I can copy and paste both into Query Analyzer, and run them fine. However, if I comment out line 3, the...
1
by: Dax | last post by:
When i insert some values float in a form made with ASP appear an error message like this: Microsoft OLE DB Provider for SQL Server (0x80040E14) Line 1: Incorrect syntax near ','. sql="select...
10
by: arial | last post by:
Hi, I am getting this error message: Incorrect syntax near the keyword 'where'. Description: An unhandled exception occurred during the execution of the current web request. Please review...
10
by: bobf | last post by:
I am using a program 'My Contact Table' which is a code generator program. It allows you to easily create a PHP/MySQL web application without writing any code. I am trying to create an additional...
1
by: karenkksh | last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. ...
9
by: icemaster451 | last post by:
Hello im making a browser game and have 99% working but iv got one error i cant find / fix and would like to know if anyone can help me where im going wrong heres the error QUERY ERROR: You have an...
1
by: Omendra | last post by:
Hi, I am using SQL Server 2005 and i am using Stored Procedure something like :- I am getting error:- Msg 170, Level 15, State 1, Line 18: Incorrect syntax near 'MAX'. DECLARE @jid AS...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.