The Way to Programming
The Way to Programming
Am doing a project on Library Management System on PHP and SQL.
I have successfully done my pages for login, add book and delete book.
I just don’t know how to put validation.
Can someone please help me?
Thanks.
Login.PHP
addbook.php
Add a new book
alert('No Title was entered was entered.
Please include a title!');"; } elseif (empty($bauthor)) { echo "
"; } $insertquery = "INSERT INTO book (b_id, b_title, b_author, f_id, status ) VALUES($bid,'$btitle','$bauthor',$fac,'$bstatus')"; $outcome = mysqli_query($dbconn, $insertquery); if($outcome) header('Location:admin.php'); else echo 'Book not Added Please Try Again!'; } ?>
deletebook.php
Delete Book
I very rarely give complete written solutions for people requiring help here. Other people can do, but I am against it, you learn a lot more by doing it yourself than copying/pasting completed code; I used to do that and I didn’t learn very much, once I started doing it myself I learnt a lot more. No pain no gain as the saying goes.
Anyway, enough of that, can you paste your source/errors that you are getting? We can work through them and iron them out.
Also, I can’t write your validation as it depends what validation you want to do.
Try providing the following student name:
'; drop table student;
You should really code this as
$query = sprintf("SELECT * FROM student WHERE s_username='%s' AND s_password='%s'", mysql_real_escape_string($uname), mysql_real_escape_string($upass));
Sign in to your account