visualwebsitedesigns
New Member
- Messages
- 39
- Reaction score
- 0
- Points
- 0
I have a quick question, im useing the following <?php code to try to connect to my newly made mysql database on my x10 hosting, I dont know what im doing wrong but what would I put for Localhost?
and dbuser, im pretty sure its visualde_visuald
it still wont connect though?
<html>
<head>
<title>Creating MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'Localhost';
$dbuser = 'visualde_visuald';
$dbpass = 'testpass';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not create database: ' . mysql_error());
}
echo "Database TUTORIALS created successfully\n";
mysql_close($conn);
?>
</body>
</html>
and dbuser, im pretty sure its visualde_visuald
it still wont connect though?
<html>
<head>
<title>Creating MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'Localhost';
$dbuser = 'visualde_visuald';
$dbpass = 'testpass';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not create database: ' . mysql_error());
}
echo "Database TUTORIALS created successfully\n";
mysql_close($conn);
?>
</body>
</html>