Re: Displaying the count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is my php code

///////////////////////start of code ///////////////////////
<html>
<head>
        
 <title>Gathering ORI Data</title>

</head>
<body>
<h1>Click on ORI and it will display all records entered by that 
ORI</h1>
<?

$db_name = "Missing_Person_Oklahoma";
$table_name = "Missing_Person";
$connection = @mysql_connect("mysql","HIDDEN", "PASSWORD") or die
(mysql_error());

$db= @mysql_select_db($db_name, $connection) or die(mysql_error());
$ip_address = getenv("REMOTE_ADDR");
$sql = "SELECT ORI, Agy_Name, Tele_Num from $table_name group by ORI 
having count(ORI) > 0";
$result = @mysql_query($sql, $connection) or die(mysql_error());


$contact_list = "<ul><strong><body bgcolor =\"#fffacd\"><font face 
=\"Courier New\" size=\"3
\">&nbsp;&nbsp;&nbsp;ORI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;Telephone 
Number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Agency 
Name<p></p>";




	//loop through results 
	while ($row = mysql_fetch_array($result)) {
          	$ori = $row['ORI'];
                $agy = $row['Agy_Name'];
                $tno = $row['Tele_Num'];
                
        $contact_list .= "<li><a href=\"show_all_ori_rec.php?
data=$ori\">$ori</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $contact_list .= "$tno&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $contact_list .= "$agy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $contact_list .= "<br>";
 
        $num = $num +1;

     }
    $contact_list .= "</ul></strong></font>";

  echo "$contact_list";

     $subject = "Oklahoma ORI Listing";
     $body = "A listing of $num ORI's that have Missing Persons 
entered in NCIC";
     $body .= "\nwas inquired by the following remote host: ";
     $body .= "$ip_address";
     $mailto = "ken.poyser@xxxxxxxxxxx";
     mail($mailto,$subject,$body,$header);

   echo "Listing of Oklahoma ORI that have Missing Persons entered in 
NCIC";
   echo "<br>There are $num different agencies with entries";
$timestamp=time();
$seconds = 6*60*60;
$timestamp-=$seconds;
$localtime = date("m/d/Y H:i:s",$timestamp);
$tz = "CST";

$localdate = substr($localtime,0,10);
$localtime = substr($localtime,11,8);

 echo "<br><br>This report was generated on $localdate at $localtime 
$tz"; 


?>
   </body>
</html>



///////////////////////////end of code//////////////////////



--- In php-objects@xxxxxxxxxxxxxxx, "Muthukumar Selvarasu" 
<muthukumar_se@...> wrote:
>
> Hi
> 
>  
> 
> give the table structure and sample data
> 
>  
> 
> Thanks,
> 
> Muthukumar Selvarasu,
> 
> Project Manager (Web Development),
> 
> Webmasters Ltd.
> 
>   _____  
> 
> From: php-objects@xxxxxxxxxxxxxxx [mailto:php-
objects@xxxxxxxxxxxxxxx] On
> Behalf Of Ken
> Sent: Tuesday, December 25, 2007 1:22 PM
> To: php-objects@xxxxxxxxxxxxxxx
> Subject:  Displaying the count
> 
>  
> 
> I have a SQL that lists the agencies that have records entered.
> 
> My SQL is
> 
> $sql = "SELECT ORI, Agy_Name, Tele_Num from $table_name group by 
ORI 
> having count(ORI) > 0";
> 
> I am wanting to show the "count" as well.
> 
> I have looked around but I haven't seen anything on how to
> display the count!
> 
> Any help would be appreciated!
> 
> Thanks
> Ken
> 
>  
> 
> 
> 
> [Non-text portions of this message have been removed]
>



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux