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
*****Welcome to use book store system*****
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started