Solved

update error

Posted on 2013-06-25
6
194 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 108

Accepted Solution

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

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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 108

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
spacing 5 31
WooCommerce Sort by Date 4 10
SQL inner join confusion 15 21
Datepicker in PHP 9 14
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now