473,945 Members | 24,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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 2321
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Line 31, insert a space after the SET and before the WHERE, would be my guess.
May 2 '11 #2
qdoet
4 New Member
've tried as your suggestion but still can not.

please tell me what I should do anymore ?
May 2 '11 #3
Dormilich
8,658 Recognized Expert Moderator Expert
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
11285
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'." Explaining you the scene is the following Stored Proc.
6
2999
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, objDataAdapter.Fill(objDataSet, "mindata") any help is greatly appriciated.
1
1459
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 syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1". Problem is I can't see any " near line. And it worked fine the first time. What am I missing? Thankyou. <?php ...
1
2362
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 assignment of "SELECT T..." to the variable query, the last line produces the error: Line 1: Incorrect syntax near '<'. Many thanks in advance for any explanation - the problem is tearing my hair out!! Iain
1
3317
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 id from tbl_monete where id_taglio="&idtaglio rs1.open sql, conn idTaglio it's the value of money that can be like 0,5 0,2, 0,1 etc etc
10
3438
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 the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'where'. Source Error:
10
50051
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 data entry page. I have copied an existing page and created a new table in my database. When I run the script I get the error message "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right...
1
6292
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. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'user'. Source Error: Line 35: MyAdapter1 = new SqlDataAdapter(MyCommand1); Line 36: MyDataSet1 = new DataSet(); Line 37: ...
9
2308
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 error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 0, '1', '2121221', '1212121', '12121', '12121', 1211, '121', 121)' at line 1 Query was INSERT INTO crimes (crimeNAME,...
1
4467
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 VARCHAR(20), @DBName As VARCHAR(50), @Query AS VARCHAR(MAX)
0
10149
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11140
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8239
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3523
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.