1,105,344 Community Members

Display status from sql table

Member Avatar
trektrak
Junior Poster in Training
72 posts since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello Guys,

I really need your ideas on this one... Ok, I'm only familiar with php and simple html coding. I'm designing simple book loan database. Consist of two sql tables (a very simple one)

table 1
book_in

table 2
book_out


Ok.. Let say, every book is determined by a code. So anyone who borrow the book, they will key in the code and key in into another table when returning the book. I know that I can make a simple php/html table to show the status...

But I would prefer more friendly interface on the key in and key out form so no confusion (to avoid them key in twice). More or less, pop out status of the book..

In a simple page, will tell you the status of the book.. if the book is showing on the page, that means the book still unavailable (Still on loan)..

Any idea.. I can think of ajax or js... But I'm totally blank with those languages.. Any helps?

Member Avatar
hag++
Posting Whiz in Training
239 posts since Jan 2010
Reputation Points: 24 [?]
Q&As Helped to Solve: 36 [?]
Skill Endorsements: 0 [?]
 
0
 

From what I could gather, I think you basically need a system where users are able to check out books (like a library system). If that's the case you really only need one table as far as recording which books a user currently has checked out. For example the BOOKS_IN_USE table would contain the book ID and the person ID who has it checked out. You could then just display a list to the user where BOOKS_IN_USE.person_id = the current user's ID. If a person has a book in that table that means they currently have it checked out. Obviously you would need other tables for the book inventory and registered users but that's outside the scope of the question.

Member Avatar
trektrak
Junior Poster in Training
72 posts since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Ok, at the moment I could display the status using a simple html php table... which will flood the page.. Maybe I need something more reliable to the user to check the status of the book... ermmm...

Member Avatar
vaultdweller123
Posting Pro
577 posts since Sep 2009
Reputation Points: 32 [?]
Q&As Helped to Solve: 84 [?]
Skill Endorsements: 2 [?]
 
0
 

you only need one table and put status on books if it's still on loan, example 1=on loan, 0 = available

Member Avatar
trektrak
Junior Poster in Training
72 posts since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Sorry... How Can i do That ? any sample?

Member Avatar
vaultdweller123
Posting Pro
577 posts since Sep 2009
Reputation Points: 32 [?]
Q&As Helped to Solve: 84 [?]
Skill Endorsements: 2 [?]
 
0
 

1st you need to add additional field on book table, let's say the name of the field is 'status' data type is int, then it has two values, 1 = on loan, 0 = available, when someone borrow a book, then that book will have it's status updated also you should add another field for borrower.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article