2 mySQL query codes

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

2 mySQL query codes

Post by bla5e »

1) whats the SQL query code to write over data? (example: news page, I have data already submitted into the mySQL db, and now i want to edit or delete that data)

2nd:
whats the SQL query to delete something out of table (yes nub, but i totally forget)
treshr
Forum Newbie
Posts: 2
Joined: Tue Jun 08, 2004 8:30 am

Post by treshr »

Use the Update command for the query.

Code: Select all

UPDATE table SET field1 = "test" WHERE id = 1
Hope this helps you.
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

what does "ID = 1" mean?

can someone post a link to explain this query to me.. because the post before this doesnt make any sense.. (or just post the hole query code)
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

id could be whatever column name you are using to determine which row you want to overwrite
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> i didnt think about that.. grrrr
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Code: Select all

DELETE FROM table where id = 1
Take a guess what that does. :D

Cheers!
Post Reply