Attach above is my question & answer(not correct) can someone edit it for me :)

MY QUESTION :
develop an online application called ‘mylibrary’. The purpose my ‘my library’ application is to record all the books
that you have purchased. Information that you have to record are
International Serial Book Number (ISBN) and the title of the book.it should be able to
1. insert,
2. view,
3. search,
4. delete and
5. update/modify
a record from the database.

MY ANSWER BUT IT DO NOT WORK PLUS THE DISPLAY PAGE show the code too

add.php
<?
mysql_connect("localhost","$0017073", "$iiiiiiii");
mysql_select_db("mylibrary") or die("database could not connect ");
?>
<html>
<head>
<meta name="description" content="Php Code for View, Search, Edit and Delete
Record" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add Library Record</title>
</head>
<body>
<center>
<h1><u>Library Database</u></h1>
</center>
<?
if($_POST["do"]=="store")
{
$isbn=$_POST["isbn"];
$title=$_POST["title"];

$query="insert into mylibrary value('$isbn','$title')";
mysql_query($query);
echo "<center>Successfully store in DATABASE</center>";
}
?>
<form name="add" method="post" action="add.php">
<table style=" border:1px solid silver" cellpadding="5px" cellspacing="0px"
align="center" border="0">
<tr>
<td colspan="4" style="background:#0066FF; color:#FFFFFF; fontsize:
20px">ADD LIBRARY RECORD</td>
</tr>
<tr>
<tr>
<td>Enter isbn</td>
<td><input type="text" name="isbn" size="20"></td></tr>
<td>Enter title</td>
<td><input type="text" name="title" size="20"></td>
</tr>
<tr>
<td colspan="4" align="center"><input type="hidden" name="do" value="store">
<input type="submit" value="ADD RECORD"></td>
</tr>
</table>
</form>
<p align="center"><a href="main.php">Go Back to Home</a></p>
<?
include("search.php");?>
</body>
</html>

## del.php ##

<?
mysql_connect("localhost","$0017073", "$iiiiiiii");
mysql_select_db("mylibrary") or die("database could not connect ");
?>
<html>
<head>
<meta name="description" content="Php Code for insert,view,search,delete and update/modify Record" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add Library Record</title>
</head>
<body>
<?
$roll=$_GET["isbn"];
$query="delete from mylibrary where isbn=$isbn";
mysql_query($query);
include("search.php");
?>
</body>
</html>
edit.php
<?
mysql_connect("localhost","$0017073", "$iiiiiiii");
mysql_select_db("mylibrary") or die("database could not connect ");
?>
<html>
<head>
<meta name="description" content="Php Code for insert,view,search,delete and update/modify Record" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Student Record</title>
</head>
<body>
<?
if($_POST["do"]=="update")
{
$ISBN=$_POST["ISBN"];
$Title=$_POST["Title"];

$query="update student set
title='$title',
where isbn='$isbn'";
mysql_query($query);
include("search.php");
}
?>
<center>
<h1><u>Library Database</u></h1>
</center>
<?
$roll=$_GET["roll"];
$query="select * from mylibrary where isbn='$isbn'";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)) {
?>
<form name="update" method="post" action="edit.php">
<table style=" border:1px solid silver" cellpadding="5px" cellspacing="0px"
align="center" border="0">
<tr>
<td colspan="4" style="background:#0066FF; color:#FFFFFF; fontsize:
20px">ADD LIBRARY RECORD</td>
</tr>
<tr>
<tr>
<td>Enter ISBN</td>
<td><input type="hidden" name="roll" size="20" value="<? echo $row[1];?>"></td>
<td>Enter Title</td>
<td><input type="hidden" name="roll" size="20" value="<? echo $row[2];?>"></td>
</tr>
<tr>
<td colspan="4" align="center"><input type="hidden" name="do"
value="update">
<input type="submit" value="UPDATE RECORD"></td>
</tr>
</table>
</form>
<? } ?>
<p align="center"><a href="main.php">Go Back to Home</a></p>
</body>
</html>
main.php
<html>
<head>
<meta name="description" content="Php Code for insert,view,search,delete and update/modify  Record" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Search Library Record</title>
</head>
<body>
<center><h1><u>Library Database</u></h1></center>
<form name="search" method="post" action="search.php">
<table style=" border:1px solid silver" cellpadding="10px" cellspacing="0px"
align="center">
<tr>
<td colspan="5" style="background:#0066FF; color:#FFFFFF; fontsize:
20px">Search</td></tr>
<tr>
<td>Enter Search Keyword</td>
<td><input type="text" name="search" size="40" /></td>
<td><input type="submit" value="search" /></td>
</tr>
<tr>
<td colspan="5"> </td></tr>
<tr bgcolor="#CCCCCC">
<th><a href="add.php">Insert Record</a></th>
<th><a href="view.php">View Record</a></th>
<th><a href="search.php">Search Record</a></th>
<th><a href="del.php">Delete Record</a></th>
<th><a href="edit.php">Update/Modify Record</a></th>

</tr>
</table>
</form>
</body>
</html>
search.php
<?
mysql_connect("localhost","$0017073", "$iiiiiiii");
mysql_select_db("mylibrary") or die("database could not connect ");
?>
<html>
<head>
<meta name="description" content="Php Code for View, Search, Edit and Delete
Record" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Search Library Record</title>
</head>
<body>
<center><h1><u>Library Database</u></h1></center>
<form name="search" method="post" action="search.php">
<table style=" border:1px solid silver" cellpadding="5px" cellspacing="0px"
align="center" border="0">
<tr>
<td colspan="3" style="background:#0066FF; color:#FFFFFF; fontsize:
20px">Search</td></tr>
<tr>
<td>Enter Search ISBN</td>
<td><input type="text" name="search" size="40" /></td>
<td><input type="submit" value="Search" /></td>
</tr>
<tr bgcolor="#666666" style="color:#FFFFFF">
<td>isbn</td>
<td>title</td>
<td> </td>
<?
$search=$_POST["search"];
$flag=0;
$query="select * from mylibrary where isbn like '%$search%' ";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$flag=1;
echo "<tr ><td>",$row[0],", ",$row[1],"</td><td><a
href='view.php?roll=",$row[0],"'>",$row[2],", ",$row[3],"</a></td><td><a
href='edit.php?roll=",$row[0],"'>Edit</a> | <a
href='del.php?roll=",$row[0],"'>Delete</a></td></tr>";
}
if($flag==0)
echo "<tr><td colspan='3' align='center' style='color:red'>Record not
found</td></tr>";
?>
<tr>
<td colspan="3"> </td></tr>
<tr bgcolor="#CCCCCC">
<th colspan="3" align="right"><a href="add.php">Add Record</a></th>
</tr>
</table>
</form>
</body>
view.php
<?
mysql_connect("localhost","$0017073", "$iiiiiiii");
mysql_select_db("mylibrary") or die("database could not connect ");
?>
<html>
<head>
<meta name="description" content="Php Code for insert,view,search,delete and update/modify Record" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>View Library Record</title>
</head>
<body>
<center><h1><u>Library Database</u></h1></center>

<?
$roll=$_GET["isbn"];
$query="select * from mylibrary where isbn='$isbn'";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)) {
?>


<table style=" border:1px solid silver" cellpadding="5px" cellspacing="0px"
align="center" border="1">
<tr>
<td colspan="4" style="background:#0066FF; color:#FFFFFF; font-size:20px">VIEW LIBRARY DATABASE</td></tr>
<tr>
<td> ISBN</td><td><? echo $row[0];?></td>
</tr>
<tr>
<td> Title</td><td><? echo $row[1];?></td>
</tr>
</table>
<?
}
?>
<p align="center"><a href="main.php">Go Back to Home</a></p>
</body>
</html>

Recommended Answers

All 3 Replies

MY ANSWER BUT IT DO NOT WORK

What does not work exactly?

when i insert the data , it does not appear in view.php and phpmyadmin plus the delete page contain code on display page and it is messy

where do i save this code and do i need a database table fort this

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.