0
<?PHP 
@session_start();
$userId=$_SESSION['userId'];

if(!session_is_registered("userId"))
{
echo "<Script language=\"javascript\">window.location=\"index.php\"</script>";
}
if(session_is_registered("userId"))
{
$userId=$_SESSION["userId"];
}
?>

<?PHP
 
require_once('conn.php');
$status="";
if($_SERVER["REQUEST_METHOD"]=='POST')
{
$username=$_POST['username'];
$userpassword=$_POST['userpassword'];
$qury="select * from login where username='$username' and userpassword='$userpassword'";
echo($qury);
$res=mysql_query($qury) or die ("can not process the query".mysql_error());
$count=mysql_num_rows($res);
if($count>0){
while($row=mysql_fetch_array($res)){
$userId=$row['userId'];
$username=$row['username'];
}

session_start();
$_SESSION['userId']=$userId;
$_SESSION['username']=$username;
echo "<Script language=\"javascript\">window.location=\"APS.php\"</script>";


}
else {
echo('badluck');
}
}
?>
3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by silviuks
0

Thats because of the first line of your code. The javascript redirection. Everytime you open the page, it will see if the session variable is set. Obviously, it will be empty. So it keeps redirecting :)

0
<?php 
require_once('conn.php');
$form_Id=$_POST['form_Id'];
$qry="delete from adm_form where form_Id=$form_Id";
echo($qry);
$res=mysql_query($qry) or die ('query not processed');
echo('record deleted');
?>

why this code also give error.
Error = delete from adm_form where form_Id=query not processed

0

Instead of die ('query not processed'); give die(mysql_error()); and tell us what it prints.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.