Table:
What I am trying to do is ++ or -- the ORD value by selecting the id_phonebook.
Query:
SELECT * FROM phonebook WHERE id_phonebook = '$entry_id' ALTER ORD-1
Am I going the right way about this or do I need to make this query more sophisticated? Not much of a DB Admin.
答案 0 :(得分:3)
I believe you need an UPDATE statement.
To increment:
update phonebook set ord=ord +1 where id_phonebook = '$entry_id'
To decrement:
update phonebook set ord=ord -1 where id_phonebook = '$entry_id'
Reference: