i am making a login page for my website.

here is the code:

<?php
include='dbconnect.php';

$tbl_name="members"; 

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
 
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

$count=mysql_num_rows($result);

if($count==1){
session_register("myusername");
session_register("mypassword");
header("location:memberpage.php");
}
else {
echo "Wrong Username or Password";
}
?>

I DO NOT GET AN ERROR BUT nothing COMES UP.....please help!

Your php.ini settings are probably incorrect.

You should use include('dbconnect.php'); rather than include=dbconnect.php;

Try:

<?php
session_start();
include('dbconnect.php');

$tbl_name="members"; 

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
 
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql) or die(mysql_error());

$count=mysql_num_rows($result);

if($count==1){
//session_register("myusername");
//session_register("mypassword");
$_SESSION['myusername']=$myusername;

header("location:memberpage.php");
exit;
}
else {
echo "Wrong Username or Password";
}
?>

ok thanks, now how do i make it say 'hi, (username)!'

On memberpage.php you need:

<?php
session_start();
echo "hi, {$_SESSION['myusername']}!";
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.