Thursday, November 13, 2014

Copy the script shown below into a .php file, replacing the hostname, database, username, and password with your Database Name and your password, etc., then upload the file to your webspace. This script is only for connecting to MySQL. Additional commands will need to be added manually


php tutorials freeCopy the script shown below into a .php file, replacing the hostname, database, username, and password with your Database Name and your password, etc., then upload the file to your webspace. This script is only for connecting to MySQL. Additional commands will need to be added manually

<?php

//ENTER YOUR DATABASE CONNECTION INFO BELOW:
$hostname="db1111111111.db.1and1.com";
$database="db1111111111";
$username="dbo111111111";
$password="myPassword";

//DO NOT EDIT BELOW THIS LINE
$link = mysql_connect($hostname, $username, $password);
if (!$link) {
die('Connection failed: ' . mysql_error());
}
else{
     echo "Connection to MySQL server " .$hostname . " successful!
" . PHP_EOL;
}

$db_selected = mysql_select_db($database, $link);
if (!$db_selected) {
    die ('Can\'t select database: ' . mysql_error());
}
else {
    echo 'Database ' . $database . ' successfully selected!';
}

mysql_close($link);
?>


Siyalla.lk Gannadeshiyade.com

0 comments:

Post a Comment