Hi friends,
I want to know, I was connecting my php login form with mysql ,i was having a problem can you provide me a solution of my problem or login form connectivity with mysql ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Nov 30, 2011, 1:53 PM
config.php
/* Database Connection */
$sDbHost = 'localhost';
$sDbName = 'test';
$sDbUser = 'root';
$sDbPwd = '';
$dbConn = mysql_connect ($sDbHost, $sDbUser, $sDbPwd) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db($sDbName,$dbConn) or die('Cannot select database. ' . mysql_error());
?>
Login.php
session_start();
include("config.php");
if($_REQUEST["btn_login"]=="submit")
{
$uname=$_POST["txt_login"];
$password=$_POST["txt_pwd"];
$sql="select * from user where user='".$uname."' and password='".$password."'";
//echo $sql;
//exit;
$res=mysql_query($sql);
if($rs=mysql_num_rows($res)>0)
{
$_SESSION["uname"]=$uname;
//echo $_SESSION["uname"];
//exit;
//echo $rs;
//exit;
echo "";
}
else
{
echo "";
}
}
?>
welcome.php
session_start();
?>
Running the application
Run the WampServer then write the below line in the Url
http://localhost/Login/
Thanks
If this post helps you mark it as answer