Click here to Skip to main content
14,981,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have tables related to library and if i give book to student to issue,at admin site i want to decrease value of book with -1 which available in book_stock table. And display updated records in that book_stock table.
like,e.g. in book_stock table there is 16 books name of software engineering, and student is sent a request to that book and librarian give that book to that student, in book_stock table updated with 15 books records. how can i decrease records -1 run time at php ? thank u .........
Updated 1-Apr-15 0:23am

Assuming you are using a database, it's a fairly simple UPDATE query:
UPDATE MyTable SET inStock = inStock - 1 WHERE BookID=TheIdForTheBookHeBorrowed
It would probably be a good idea to include the whole thing in a stored procedure if you can, or at the least within an SQL Transaction.
Member 11572517 1-Apr-15 6:27am
thank u for response i do according this ....
You have to run an update query on the database and decrease the record by .
For e.g.
Update Data In a MySQL Table[^]

For basics on update queries - Update (SQL)[^].
Member 11572517 1-Apr-15 6:33am
thank u for response i do according this..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900