Solved

update error

Posted on 2013-06-25
6
196 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
6 Comments
 
LVL 109

Accepted Solution

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

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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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 109

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery 10 20
how to use Initialization Vector for openssl_encrypt() 5 26
JS does not refresh 6 19
Jquery Validation Messages Not Showing Up 3 12
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

772 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