Problem Help Please 2 | PHP2

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sazzadraju
Forum Newbie
Posts: 7
Joined: Mon Mar 15, 2010 12:31 pm

Problem Help Please 2 | PHP2

Post by sazzadraju »

<?php include("dbconnection.php");?>


<?php


$login = $_POST['login'];
$pass = $_POST['pass'];

$query = mysql_query ("SELECT * FROM users WHERE login = '$login' and pass = '$pass'");
if (mysql_num_rows ($query) > 0 )
{
session_start ();
$_SESSION['login'] = $login;
print "<script>";
print " self.location='order_list.php';";
print "</script>";


}
else {
print "<script>";
print " self.location='admin-login.html';";
print "</script>";
}
?>


when i try to login its show message like this

Cannot add header information - headers already sent by (output started at /var/www/.........../check.php:2)in home/..../......../check.php on line 14


after a few moment login become successful....
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Problem Help Please 2 | PHP2

Post by JakeJ »

It would help if we knew which line was line 14.

Also, it's completely unnecessary for you to enclose your dbconnetion string in a separate php statement unless you have some html code that goes in between that you are not quoting.
Post Reply