Solved

update error

Posted on 2013-06-25
6
198 Views
Last Modified: 2013-06-25
Hi,

I get an error with update and I am not sure how to fix it. The data gets passed from html and the cols in mysql exist.

$query = "UPDATE tbmod1 VALUES set    q1='$q1', q2='$q2', q3='$q3', q4='$q4', q5='$q5', q6='$q6', q7='$q7', q8='$q8', q9='$q9', q10='$q10 ',q11='$q11',q12='$q12' where user='a'";

$result = mysql_query($query) or die(mysql_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 'VALUES set q1='enter here', q2='enter here', q3='enter here', q4='asd', q5='k' at line 1
0
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39274721
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39274725
Also, you want to get off of MySQL.  PHP is removing it.  This article explains why and what you must do to keep your scripts running.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html
0
 
LVL 22

Expert Comment

by:Om Prakash
ID: 39274727
Try
$query = "UPDATE tbmod1 set    q1='$q1', q2='$q2', q3='$q3', q4='$q4', q5='$q5', q6='$q6', q7='$q7', q8='$q8', q9='$q9', q10='$q10 ',q11='$q11',q12='$q12' where user='a'";
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39274741
The problem is VALUES Remove Values from your query:
$query = "UPDATE tbmod1 set    q1='$q1', q2='$q2', q3='$q3', q4='$q4', q5='$q5', q6='$q6', q7='$q7', q8='$q8', q9='$q9', q10='$q10 ',q11='$q11',q12='$q12' where user='a'"; 

Open in new window

0
 

Author Comment

by:jagguy
ID: 39274745
ok it works thanks.

What I might do is use mysql and when php5.5 comes in , change what I have then. I dont use mysql/php enough to really worry about the latest method .
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39274782
Thanks for the points.  

I think you may be missing the importance of PHP's direction with the MySQL extension.  It's not about whether your PHP/MySQL scripts will keep running (they will run for a while and will break eventually).  It's about object-oriented programming, security, and object reuse.  As PHP matures, so must the programming techniques of PHP users.  As PHP moves forward in time, support is removed for older releases.  Today, PHP 5.4 is current and PHP 5.2 is no longer supported, not even for security exploits.  So if someone finds a way to hack a PHP 5.2 site, the only recourse the site publisher has is to upgrade.  It's a terrible thing to find yourself doing an emergency upgrade.  That's why professionals take the longer view and stay on top of advancements in technology and technique.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question