Hi,
Here is my codings.Pl help me to change the bgcolor when the value in td11
becomes 0.
[PHP]<?
session_start();
?>
[/PHP][HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />-->
<!--<meta http-equiv="refresh" content="3" />-->
<title>Live Campaign Report</title>
<link href="main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.odd{background-color:#acbdee;}
.even{background-color:#cddeff;}
</style>
</head>
<body onload="alternate('thetable')">
<div id="header"><h2><img src="images/ptlogo.gif" /></h2>
<h1><img src="images/pt1.gif" width="870px" height="120px" /></h1>
</div
><DIV id=content-wrap>
<DIV id=content>
<DIV>
<H1 class="h1">Live Campaign Report</H1></DIV>
<STYLE>A {
TEXT-DECORATION: none
}
A:hover {
TEXT-DECORATION: none
}
A:visited {
TEXT-DECORATION: none
}
A:link {
TEXT-DECORATION: none
}
</STYLE>
[/HTML]
[PHP]<?PHP
include("conn.php");
$sel= mysql_select_db("dialer");
include("function.php");
$fdate = date('d-m-Y');
$tdate = date('d-m-Y');
$tables=$_GET['tables'];
/* $fdate = $_POST['fdate'];
$tdate = $_POST['tdate'];
$submit = $_POST{'submit'};*/
?>
[/PHP]
[HTML]<body>
</div>
<DIV id=content-wrap>
<DIV id=content>
<br /><center>
<td colspan="4" align="center" >Select Campaign:
<form name="myform" method="POST" action="manage1_campaign1.php">
[/HTML][PHP]<?php
$list = mysql_list_tables ("dialer");
echo" <select name='tables' value=\'\' onChange='tablepick();'>";
$i = 0;
//echo "<option value=''>Select Table</option>";
if($_GET['tables'])
{
echo "<option value='$tables' selected>$tables</option>";
}
while ($i < mysql_num_rows ($list)) {
$tb_names[$i] = mysql_tablename ($list, $i);
echo"<option value='$tb_names[$i]'>$tb_names[$i]</option>";
$_SESSION['tables']=$_GET['tables'];
$i++;
}
echo "</select>";
?>
</form>
<?php
//echo $submit."<br>";
$fdate1 = explode("-",$fdate);
//print_r $fdate1;
$fdate3 = (strlen($fdate1[1]) == '1') ? "0".$fdate1[1] :$fdate1[1] ;
$fdate4 = (strlen($fdate1[0]) == '1') ? "0".$fdate1[0] :$fdate1[0] ;
$fdates = $fdate1[2]."-".$fdate3."-".$fdate4;
if($fdate == $tdate)
{
$tdates1 = mktime(0,0,0,$fdate3,$fdate4+1,$fdate1[2]);
$tdates=date("Y-m-d", $tdates1);
// echo "Tomorrow is ".$tdates;
} else{
$tdate1 = explode("-",$tdate);
$tdate3 = (strlen($tdate1[1]) == '1') ? "0".$tdate1[1] :$tdate1[1] ;
$tdate4 = (strlen($tdate1[0]) == '1') ? "0".$tdate1[0] :$tdate1[0] ;
$tdates = $tdate1[2]."-".$tdate3."-".$tdate4;
}
//echo "<table cellspacing=5 cellpadding=5 border=0 align=center><tr class=h3><td>From Date </td></tr>";
echo "<tr> <td> </td></tr></table>
<table border=1 width=95% align=center id='thetable'>
<tr><td class='th'>FreshRecord</td></td><td class='th'>Sale</td>
<td class='th'>CallBack</td><td class='th'>HangupAfterListen</td>
<td class='th'>AnsweringMachine</td><td class='th'> Busy</td>
<td class='th'>NotInterested</td><td class='th'>OverPhone</td>
<td class='th'>MoveAway</td><td class='th'>LanguageBarrier</td>
<td class='th'>Contact</td></tr>";
if($fdate != $tdate){
}
if ($tables=$tables)
{
$td1 = mysql_query("SELECT count(*) FROM $tables where disposition ='1'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td11 = mysql_fetch_row($td1);
$td2 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='12'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td22 = mysql_fetch_row($td2);
$td3 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='0'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td33= mysql_fetch_row($td3);
$td4 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='2'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td44 = mysql_fetch_row($td4);
$td5 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='3'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td55 = mysql_fetch_row($td5);
$td6 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='4'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td66 = mysql_fetch_row($td6);
$td7 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='5'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td77 = mysql_fetch_row($td7);
$td8 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='6'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td88 = mysql_fetch_row($td8);
$td9 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='7'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td99 = mysql_fetch_row($td9);
$td10 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='9'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td1010 = mysql_fetch_row($td10);
$td112 = mysql_query("SELECT count(*) FROM $tables where lastupdated >='$fdates' and disposition ='11'");
//$td1 = mysql_query("SELECT count(*) FROM asterisk.cdr where calldate ='$fdates' and length(src) =10 and lastapp <>'v%'");
$td1111 = mysql_fetch_row($td112);
echo "<tr>
if($td11[0]==0)
{
echo"<td bgcolor="red">$td11[0]</td>";
}
else
{
echo"<td bgcolor="green">$td11[0]</td>";
}
<td>$td22[0]</td>
<td>$td33[0]</td>
<td>$td44[0]</td>
<td>$td55[0]</td>
<td>$td66[0]</td>
<td>$td77[0]</td>
<td>$td88[0]</td>
<td>$td99[0]</td>
<td>$td1010[0]</td>
<td>$td1111[0]</td></tr>";
}
?>[/PHP]
[HTML]</td>
<tr>
</tr>
</table>
</center>
</DIV>
</DIV><br />
<div id="footer">
<hr />
<table border=0 cellspacing=0 cellpadding=0>
<tr><td align="left">
<table width="400px">
<tr>
<td><a href="live_reports.php"><img src="images/back.jpg" /></a></td>
</tr>
</table>
</td>
<td>
<table width="450px">
<tr><td align="left">© PeopleTech</td></tr>
</table>
</td>
<td>
<table><tr>
<td align="right"><a href="home.php"><img src="images/home.jpg" /></a></td></tr></table>
</td>
</tr>
</table>
</div>
<script language="javascript">
var sURL = unescape(window.location.pathname);
function tablepick(){
var val=document.myform.tables.value;
//document.form1.client.value = document.form1.store_id.value;
var ul =sURL +'?tables='+ val;
window.location.href =ul ;
//alert('hai');
}
function alternate(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
//manipulate rows
if(i % 2 == 0){
rows[i].className = "even";
}else{
rows[i].className = "odd";
}
}
}
}
</script>
<script type="text/javascript">
function reFresh() {
location.reload(true)
}
window.setInterval("reFresh()",1000);
</script>
</body>
</html>[/HTML]
Suguna