473,382 Members | 1,476 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,382 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 2283
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.