Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I have already asked this question and received the below code but

I have already asked this question and received the below code but
I still can not connect to the database. It just tells me “Can not use school as the current database:” I have my table made and know that it has information. Can someone explain why I am not getting past the “Can not use school as current database:”

CREATE TABLE UserName ( UserNameID int(9) NOT NULL auto_increment, userName VARCHAR(40) NOT NULL, pass VARCHAR(40) NOT NULL, PRIMARY KEY(UserNameID) );

<?php

//connect to the database
$databaseHost = ‘localhost’;
$databaseName = ‘UserName’;
$databaseUsername = ‘root’;
$databasePassword = ‘root’;

$query = mysqli_connect(‘localhost’, ‘root’, ‘root’);

if (!$query) {

die(‘Not connected : ‘ . mysqli_error());

}

// make school the current db

$db_selected = mysqli_select_db(‘UserName’, $link);

if (!$db_selected) {

die (‘Can not use school as the current database: ‘ . mysqli_error());

}

//login to the system using the credentials provided by the user

//we start by obtaining the values as input by the user from the form

$user_name = mysqli_real_escape_string($_REQUEST[‘u_name’]);

$password = mysqli_real_escape_string($_REQUEST[‘pwd’]);

//we then retrieve what is actually stored in the database

$sql = “SELECT * FROM UserName WHERE userName= ‘”.$user_name.”‘ and password='”.$password.”‘”;

$r_query = mysqli_query($sql);

while ($row = mysqli_fetch_array($r_query)){

$user=$row[‘username’];

$pass=$row[‘password’];

}

//we then compare to see if the user data matches what is in the DB.

//If Yes, we log them in

if($user_name.equals($user) && $password.equals($pass)){

echo”logged in!”;

}

else{

echo”wrong username or passsword”;

}

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"