unable to connect to my database

Status
Not open for further replies.

apysan

New Member
Messages
15
Reaction score
0
Points
0
i have the following code
<?php
$con = mysql_connect("apysan.x10hosting.com","apysan_apysan","bharat");
//$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("apysan_database", $con);
// check username
$checkuser = mysql_query("SELECT username FROM users WHERE username='$_POST[username]' and password='$_POST[password]'");
$username_exist = mysql_num_rows($checkuser);
if($username_exist == 1)
{
//echo "login successful";
echo "<br><br><br><body bgcolor='black' text='Green' link='white' alink='white' vlink='purple'><center><BIG><BIG><BIG>You are Successfully Loged In</BIG></BIG></BIG><br><br><a href='index2.htm'><h4>Proceed</h4></a></center></body>";

}
else
{
echo "<br><br><br><body bgcolor='black' text='red' link='purple' alink='purple' vlink='purple'><center><BIG><BIG><BIG>Unable to Log you In!</BIG></BIG></BIG><br><br><a href='a.htm'><h4>Back</h4></a></center></body>";
//notlog();

//unset($username);
//unset($password);
//include 'a.htm';
//exit();

}
mysql_close($con)
?>
 

brinni1

New Member
Messages
145
Reaction score
1
Points
0
the host should be "localhost" e.g

mysql_connect("localhost","apysan_apysan","bharat");
 
Last edited:
Status
Not open for further replies.
Top