Jump to content

Recommended Posts

I accidentally executed the following SQL query a moment ago:

 

UPDATE con SET contribution = '$contribution', category = '$contribution_category', description = '$contribution_description'

 

This updated the whole table (every single row), which taught me a lesson.

 

I would like to know is there a way to limit the query to just one single row, to avoid an updating of the whole table on big projects?

 

This happened in the development environment, so it is not a big deal and can be checked as lesson learned.

 

Quite dangerous this one.

Link to comment
https://forums.phpfreaks.com/topic/252913-limit-to-only-one-row/
Share on other sites

fenway, what do you mean by that?

 

Will it not work how I imagined it in the sense of the thread?

I mean that you'll get an arbitrary row - the order of the rows examined by MySQL is totally arbitrary (in the sense that you can't guess what it will be).

 

if you want a particular one of the rows updated, and not others, you'll need both ORDER BY and LIMIT.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.