MySql Connection

Dear Sir,

HTML file has following codes

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Connection Checking</title> </head> <body> <center> <h1>Connection Checker</h1> <fieldset style=width:300px;background-color:#E0FFFF> <legend sytle=font-size:12;>Click Connect</legend> <form name="form1" action="connect.php" method="post"> <table> <tr><td></td><td align="center"><input type="submit" name="button1" value="Connect"> </td></tr> </table> </form> </fieldset> </center> </body> </html>

and Connect.php has folllowing codes


    <?php
    // Connection variables
    $host="localhost";
    $username="root";
    $password="";
    $db_name="asia"; 
    
    // Connect to database
    $con=mysqli_connect("$host", "$username", "$password");
    
    // Connect result
    if(!$con){
    die('Error Connecting to Database: ' . mysqli_error());
    }
    else
    {
    echo "Connected" . mysqli_error($con);
    }
    //close the connection
    //mysql_close($con);
    ?>
    

Both files have no problems and works fine.

But I need following modifications:

When connection is established then this line trigs from connect.php

echo "Connected" . mysqli_error($con);

While standing on html page, I want to show a messagebox like in attachment

Please help


connected.jpg

You can do a javascript Popup.

Change:

[php]echo “Connected” . mysqli_error($con);[/php]

To Something like this:

[php]echo ‘’;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service