Alert stops responding

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
batowiise
Forum Commoner
Posts: 28
Joined: Fri Dec 17, 2010 7:11 am

Alert stops responding

Post by batowiise »

Hi all,

The code below is supposed to pop up an alert based on the condition specified. It works fine for about six (6) entries or transaction. On the seventh transaction, the alert stops responding.

<?php
session_start();
$username = $_SESSION['username'];

require_once("admin/db.php");
$result = mysql_query("SELECT * FROM users WHERE username='$username'") or die(mysql_error());
$rs = mysql_query("SELECT * FROM generalclaims") or die(mysql_error());
$rsdepartment = mysql_query("SELECT * FROM generalclaims WHERE department='FINANCE'") or die(mysql_error());
$rsgenapprovallevel = mysql_query("SELECT * FROM generalclaims") or die(mysql_error());

$pettycashapprover = mysql_result($result,0,'pettycashapprover');
$approvallevel = mysql_result($result,0,'approvallevel');
$userdepartment = mysql_result($result,0,'department');
$systemapprovallist = mysql_result($rs,0,'systemapprovallist');
$gendepartment = mysql_result($rsdepartment,0,'department');

if($_SESSION['username'] == $username && $pettycashapprover == 'YES' && $approvallevel == 'FIRST' && $userdepartment == 'FINANCE' && $systemapprovallist == 'FIRST'&& $gendepartment == 'FINANCE')
{
echo"<script>alert('Issues Pending for your approval.');</script>";
}

elseif($_SESSION['username'] == $username && $pettycashapprover == 'YES' && $approvallevel == 'SECOND' && $systemapprovallist == 'SECOND')
{
echo"<script>alert('Issues Pending for SECOND your approval.');</script>";
}

elseif($_SESSION['username'] == $username && $pettycashapprover == 'YES' && $approvallevel == 'THIRD' && $systemapprovallist == 'THIRD')
{
echo"<script>alert('Issues Pending for THIRD your approval.');</script>";
}
?>

I have cross checked the records in the database and everything is fine from the records in the database.

Can anyone help me out?

Regards.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Alert stops responding

Post by social_experiment »

batowiise wrote:It works fine for about six (6) entries or transaction
Is this a pattern? The problem could be with the conditions that has to be met each time.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply