I am working on library system and having a table of rack and a table of books.
Every book should belong to one rack and no rack can contain more than 10 books when user is adding a book in database when he select a rack if it already contains 10 books in it then it should prompt an alert.
Only 10 books can be added in a rack. An alert should prompt if user is trying to add more books. How can I do please help me.
<?php
$msg="";
$query1 = "SELECT * FROM tbl_rack";
$result1 = mysql_query($query1);
if(isset($_POST['btnadd']))
{
$title =$_POST['txttitle'];
$author =$_POST['txtauthor'];
$year =$_POST['txtyear'];
$rack =$_POST['txtrack'];
$query="insert into tbl_books(book_title,book_author,book_year,book_rack)values('$title','$author','$year','$rack')";
$rs = mysql_query($query);
if ($rs == 1)
$msg="Book has been added successfully" ;
else
$msg="Try Again";
}