I have a login.html in which the form is defined as follows:
<form method="post" action= "do_authorize.php"  name="lform">
  <span class="style1">First Initial Plus Last Name :</span>  
    <input type="text" name="user" size="25">
    <input type="submit" value="login">
</form>
My do_authorize is as follows:
<?php
session_start();
require('../databaseConnectionFileFolder/dbconnection.php');
$user             = $_POST["user"]; 
var_dump($user);
$_SESSION['username']=$user;
var_dump($user);
$sql="SELECT * FROM $table_name_users WHERE username = \"$user\"";
var_dump($sql);
$result=@mysql_query($sql,$connection) or die("couldn't execute query");
$num=mysql_numrows($result);
if ($num != 0) {
/*$cookie_name="$user";
$cookie_value="ok";
$cookie_expire=time()+86400;
$cookie_domain=".columbia.edu";
setcookie($cookie_name, $cookie_value, $cookie_expire, "/", $cookie_domain, 0);
*/
    print "<script>";
    print "self.location='somethingelse.php';";
    print "</script>";
} else {
echo "<p>you're not authorized";
}
?>
My dbconnection.php file is as follows:
<?php
$db_server      = "localhost"; 
$db_name        = "DailyExerciseDB"; 
$db_user        = "abc5"; //the database username
//$db_password      = "123"; // the database user pasword
$connection=@mysql_connect($db_server,$db_user) or die("Could Not Connect to the Database :   ". mysql_error());
var_dump($connection);
$db=@mysql_select_db($db_name, $connection) or die("Could Not Select the Database". mysqli_connect_error());
//var_dump($db);
?>
My Questions:
1) I keep on getting Could Not Select the Database, why does the warning/error message corresponding to . mysqli_connect_error() doesn't get printed on the browser?
2) I have manually entered the user with username abc5 in the database and still it's not able to connect.Does anyone know why?
3) Even if I don't enter anything in the login.html and press login button, the following files gets executed, how can I take user entered into account while verifying with database? I believe since its hardcoded right now abc5, all files are getting executed.
4) var_dump($connection); prints resource(4, mysql link)
 
    