I am not able to run the code..
Title
Question
Fatal error<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;">: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\connect.php:2 Stack trace: #0 C:\xampp\htdocs\mysql.php(2): require() #1 {main} thrown in </span>C:\xampp\htdocs\connect.php<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;"> on line </span>2
<font color="#000000" face="Times New Roman" size="3">This keeps showing up..</font>
<font color="#000000" face="Times New Roman" size="3">what to do sir, or mam...</font>
PHP-and-MySQL MySQL-Part-2 04-05 min 0-10 sec
Answers:
Dear User,
If you are using a newer version of PHP then it should give an error. Please use mysqli function instead of mysql function.
For example:
<?php
$connect = mysqli_connect("localhost","root","") or die("Connection Failed!");
mysqli_select_db("$connect","phpacademy") or die(mysqli_error());
echo "Connected!<p>";
?>$connect = mysqli_connect("localhost","root","") or die("Connection Failed!");
mysqli_select_db("$connect","phpacademy") or die(mysqli_error());
echo "Connected!<p>";
Login to add comment