1

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>
Otrz
  • 45
  • 6
  • PHP 7? _**Warning** This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0._ See http://php.net/manual/en/mysqlinfo.api.choosing.php – AbraCadaver Dec 18 '17 at 19:00

0 Answers0