hey, i am new in php.
i try to create a simple web page in php and everything are ok if i use my local Apache server (wamp).
i write the following code:
Code: Select all
<?php
$dbhost = 'myhost';
$dbuser = 'myusername';
$dbpass = 'mypassword';
session_start();
$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die ('Error connecting to mysql');
$dbname = 'mydatabase';
mysql_select_db($dbname);
$email = $_REQUEST["email"];
$pwd = $_REQUEST["password"];
$type = $_REQUEST["type"];
if($email != null){
if ($type=="m"){
$sql = "SELECT * FROM members WHERE email = '$email' AND password = '$pwd'";
$result = mysql_query($sql);
if($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$m = "yes";
$_SESSION['member']= $m;
$_SESSION['email']= $row['email'];
$_SESSION['fullname']= $row['fullname'];
$_SESSION['memberid']= $row['memberid'];
header( 'Location: memberAccount.php' );
}else{
header('Location: registerlogin.php?err=1');
}
}else{
$sql = "SELECT * FROM administrator WHERE email = '$email' AND password = '$pwd'";
$result = mysql_query($sql);
if($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$m = "yes";
$_SESSION['administrator']= $m;
$_SESSION['email']= $row['email'];
$_SESSION['fullname']= $row['fullname'];
$_SESSION['administratorid']= $row['administratorid'];
header('Location: administratorAccount.php');
}else{
header('Location: registerlogin.php?err=1');
}
}
}
?>if anyone can help me i will appreciate in advance
Thank you!!!
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: