Call to undefined function mysql query with Login

0 votes

When I run this PHP code I am getting a fatal error.

Code

    <?php


    $user = 'root';

    $password = 'root';

    $db = 'inventory';

    $host = 'localhost';

    $port = 8888;


    $link = mysqli_init();

    $success = mysqli_real_connect(

       $link,

       $host,

       $user,

       $password,

       $db,

       $port

    );


    ?>

    <?php

    $username = $_POST['username'];

    $password = $_POST['password'];

    $sql = mysql_query("SELECT * FROM login WHERE username = '".$_POST['username']."' and password = '".md5($_POST['password'])."'");

    $row = mysql_num_rows($sql);

    if($rom > 0 )

    {

      session_start();

      $_SESSION['username'] = $_POST['username'];

      $_SESSION['password'] = $_POST['password'];

      echo "login done";

    }else {

      echo "fail login ";

    }

The Error

PHP Fatal error: Uncaught Error: Call to undefined function mysql_query() in /Applications/MAMP/htdocs/lprapp/config.php:23 Stack trace:#0 {main} thrown in /Applications/MAMP/htdocs/lprapp/config.php on line 23

Can someone help me with this issue?

May 1 in Other DevOps Questions by Kichu
• 16,250 points
18 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Other DevOps Questions

+1 vote
1 answer

How to deal with non-fast forward errors?

This error is faced when git cannot ...READ MORE

answered Jul 3, 2018 in Other DevOps Questions by Sophie may
• 10,590 points
20,033 views
0 votes
1 answer

SonarQube cannot connect to JIRA 7 with REST API

The JIRA Plugin is not compatible with JIRA 7 ...READ MORE

answered Jul 5, 2018 in Other DevOps Questions by Kalgi
• 52,350 points
373 views
0 votes
1 answer
0 votes
1 answer
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
508 views
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
8,997 views
0 votes
1 answer

Failure uploading Image on AmazonS3 with PHP SDK

Try this, I took it out from ...READ MORE

answered May 4, 2018 in AWS by Cloud gunner
• 4,650 points
2,024 views
0 votes
1 answer

Trying to call AWS API via PHP

Try using AWS SDK for PHP, Link ...READ MORE

answered Jun 6, 2018 in AWS by Cloud gunner
• 4,650 points
961 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP