I was trying to make a consult in DB to check if this variable
$vx = "Test";
Exist in DB:
'news'
In colum 'Name'
But its showing this error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\folder\peahape.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\folder\peahape.php on line 5
What I did wrong? Full code:
<html>
<head><title>PHP TEST</title></head>
<body>
<?php
mysql_connect('localhost', 'root', '') or trigger_error(mysql_error());
$vx = "Test";
$sql = "SELECT `ID` FROM `news` WHERE (`Name` = '".$vx."') LIMIT 1";
$query = mysql_query($sql);
if (mysql_num_rows($query) != 1) {
echo "SUCESS!";
} else {
echo "FAIL!";
}
?>
</body>
</html>