PHP code that I need help in. PLEASE

[php]<?php
require ‘connection.php’;
if(isset( $_POST[‘search’])){
search();
}
if (isset($_POST[‘add’])){
add();
}
display();

function Add() {
$Student_Name= $_POST[‘Student_Name’];
$Student_TA= $_POST[‘Student_TA’];
$Book_Name= $_POST[‘Book_Name’];
$Book_Volume= $_POST[‘Book_Volume’];
$Date = Date(‘y-m-d’);
if(!empty($Book_Volume)&&!empty($Book_Name)&&!empty($Student_TA)&&!empty($Student_Name)) {
$query = “INSERT INTO books( Student_Name, Student_TA, Book_Name, Book_Volume, Date) VALUES (’$Student_Name’, ‘$Student_TA’, ‘$Book_Name’, ‘$Book_Volume’, ‘$Date’)” || die(‘could not insert.’);
echo’insertion was sucessful.’;
}
}
function search() {
$search_name = $_POST[‘search_name’];
if(!empty($search_name)){
$query = ‘SELECT * FROM books WHERE Student_Name LIKE "%’.mysql_real_escape_string($search_name).’%"’;
$query_run = mysql_query($query);
if (mysql_num_rows($query_run)>=1){
while ($query_row = mysql_fetch_assoc($query_run)) {
$ID = $query_row[‘ID’];
$Student_Name = $query_row[‘Student_Name’];
$Student_TA = $query_row[‘Student_TA’];
$Book_Name = $query_row[‘Book_Name’];
$Book_Volume = $query_row[‘Book_Volume’];
$Date = $query_row[‘Date’];

			echo $ID.' | '.$Student_Name.' | '.$Student_TA.' | '.$Book_Name.' | '.$Book_Volume.' | '.$Date.' |<br>';
		}
	} else {
		echo 'No Data Found.';
	}
}else {
	echo'enter a name';
}

}
function Display() {
$query = “SELECT * FROM books”;
$query_run = mysql_query($query);
while ($query_row = mysql_fetch_assoc($query_run)) {
$ID = $query_row[‘ID’];
$Student_Name = $query_row[‘Student_Name’];
$Student_TA = $query_row[‘Student_TA’];
$Book_Name = $query_row[‘Book_Name’];
$Book_Volume = $query_row[‘Book_Volume’];
$Date = $query_row[‘Date’];

	echo $ID.' | '.$Student_Name.' | '.$Student_TA.' | '.$Book_Name.' | '.$Book_Volume.' | '.$Date.' |<br>';
}

}
?>

Search by Student's Name:
Add -> Student's Name: Student's TA: Book's Name: Book's Volume#: [/php]

Hey everyone,

in the code above i’m trying to make my website to display a data from a mysql database and then search if the user has clicked on the search submit button and add if the user clicked on the add submit button. but the problem is when i everytime try to search or add to the database it shows me this page:

"Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7"

the function name is Add, but you’re using add. functions are case specific. same thing with Display (vs display as you’re using it).

Sponsor our Newsletter | Privacy Policy | Terms of Service