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?

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.

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...

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.