![]() |
Updating users
I have made my own CMS, but if I try to update the users rows or edit the users rows, it would change every row in the column to what I put in!
Yet, I did the same procedure with making a news editing system and that turned out fine. |
You forgot a WHERE clause in the UPDATE statement, I'm sure of that. Review the update query.
|
Quote:
Update: nevermind, the news system is now doing it. -_- Why is this happening.. It didn't happen before. -_- |
Perhaps you could paste the query in here?
|
Quote:
PHP Code:
|
I see no where statement, so of course it'll set everything. You need to make it userid dependent.
|
Quote:
PHP Code:
|
Yeah, pretty much. I'd also combine it with a:
sql Code:
|
Quote:
|
Can you show me your current query please? LIMIT is the absolute last statement you should include.
|
Quote:
Quote:
PHP Code:
|
It'll make things infinitely easier for you if your code is laid out nicely and easier to read. Also the clauses in the query should go UPDATE, SET, WHERE, LIMIT; in that order. The WHERE clause should catch only a single row (assuming you check against a primary key column) but just in case the LIMIT is there to make sure only one row is affected.
PHP Code:
|
Quote:
I'm getting this: Code:
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 'WHERE id = 2 LIMIT 1' at line 9 |
I guess, nobody can help me :[
|
Take of the last ","
|
Yes, I did that just a few minutes ago, but thanks for helping me anyway. :] And yes it's working successfully!
|
| All times are GMT. The time now is 01:05 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0