Question: I am receiving an error that I cant seem to fix. Can I get some help please? The error I am receiving is : Fatal

I am receiving an error that I cant seem to fix. Can I get some help please? The error I am receiving is : Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\hello.php:37 Stack trace: #0 {main} thrown in C:\xampp\htdocs\hello.php on line 37

Research indicated that I change code from mysql to msqli but that did not work either.

The code is :

Book Store

Book Store

*****Welcome to use book store system*****

Find entries that are:

Author:

Title :

Year :

session_start();

if($_GET){

$author = $_GET['author'];

$title = $_GET['title'];

$select = $_GET['select'];

$connect = mysql_connect("localhost", "root", "") or die(mysql_error());

if($connect)

{

mysql_select_db("mysql", $connect);

$query = "SELECT * FROM bookstore WHERE author='" . $author . "' or Title='" . $title . "' ";

$query2 = "SELECT * FROM bookstore WHERE Year = '" . $select ."' ";

$result = mysql_query($query) or die(mysql_error());

$result2 = mysql_query($query2) or die(mysql_error());

while($row = mysql_fetch_array($result)){

echo $row['ISBN'] . "
" . $row['Title'] . "
" . $row['Author'] . "
" . $row['Publisher'] . "
" . $row['Year'] . "
";

}

while($row2 = mysql_fetch_array($result2)){

echo $row2['ISBN'] . "
" . $row2['Title'] . "
" . $row2['Author'] . "
" . $row2['Publisher'] . "
" . $row2['Year'] . "
";

}

} else {

die(mysql_error());

}

mysql_free_result($result);

mysql_close();

}

?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!