Sir, I am new to php. I have following codes to connect with mysql
<?php
// Connection variables
$host="localhost";
$username="root";
$password="";
$db_name="asia";
// Connect to host
$con=mysqli_connect($host, $username, $password);
// Connect result
if(!$con){
die '<script type="text/javascript">alert("Error Connecting to HOST")'. mysqli_connect_error($con).'</script>';
}
else
{
echo "Connected" . mysqli_error($con);
}
// Database Selection
$sel =mysqli_select_db($con,"$db_name");
// Database Selection result
if(!$sel){
die '<script type="text/javascript">alert("Error Connecting to database")'. mysqli_connect_error($con).'</script>';
}
else
{
echo "Database Selected" . mysqli_error($con);
}
?>
On this line
die '<script type="text/javascript">alert("Error Connecting to HOST")'. mysqli_connect_error($con).'</script>';
it says:
**Parse error: syntax error, unexpected ''<script type="text/javascript' (T_CONSTANT_ENCAPSED_STRING) in C:\wamp\www\connect.php on line 13
**
Actually I want to show alert messagebox.
Please let me know what am doing wrong?