Question: 1. I am trying to create a login page using WAMP Server, PHP, SQL... but I keep getting this error. I don't know what the

1. I am trying to create a login page using WAMP Server, PHP, SQL... but I keep getting this error.

I don't know what the error is about, I made a PHP file for the connection alone and it worked but when I implement it here it shows this PARSE ERROR and I don't know if the error is about the code itself or if its something else.

How can I fix it?

( ! ) Parse error: syntax error, unexpected variable "$conn" in C:\wamp64\www\FirstProject\FirstProject.php on line 9

Here's the code:

//connection //$conn = new mysqli($servername, $username, $password, $dbname); $conn = mysqli_connect($servername, $username, $password, $dbname);

// Check connection if (mysqli_connect_error()) { die("Database connection failed: " . mysqli_connect_error()); } if ($_POST){ $uname = $_POST["username"]; $pass = $_POST["password"]; $sql = "SELECT * FROM firsttable WHERE username = '$uname' AND password = '$pass'"; $result = mysql_query($conn, $sql); if(mysql_num_rows($result)==1){ echo "WELCOME!"; } else { echo "Incorrect password or username"; } } ?> Login



2. How can I create an SQL Injection for this?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!