setQuery($sql); $cur = $mydb->executeQuery(); $numrows = $mydb->num_rows($cur);//get the number of count }else{ $sql = "SELECT * FROM tblpeople WHERE LOCATION='".$location."'"; $mydb->setQuery($sql); $cur = $mydb->executeQuery(); $numrows = $mydb->num_rows($cur);//get the number of count } }elseif (isset( $_POST['search'])){ $sql = "SELECT * FROM tblpeople WHERE FNAME LIKE '%".$search."%'"; $mydb->setQuery($sql); $cur = $mydb->executeQuery(); $numrows = $mydb->num_rows($cur);//get the number of count }else{ $sql = "SELECT * FROM tblpeople"; $mydb->setQuery($sql); $cur = $mydb->executeQuery(); $numrows = $mydb->num_rows($cur);//get the number of count } # code... if ($numrows > 0) { # code... $cur = $mydb->loadResultList(); foreach ($cur as $res) { //date in mm/dd/yyyy format; or it can be in other formats as well // $birthDate = "12/17/1983"; @$formatdate = date_format(date_create($res->DIEDDATE),'m/d/Y'); $birthDate = $formatdate; //explode the date to get month, day and year $birthDate = explode("/", $birthDate); //get age from date or birthdate @$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2])); // echo "Age is:" . $age; echo ''; echo ''; // echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } }else{ echo ''; echo ''; echo ''; } ?>
Grave No Name of the Deceased Born Died Location Years Buried
'.$res->GRAVENO.''.$res->LNAME.','.$res->FNAME.' '.$res->MNAME.''. $res->FNAME.''.$res->BORNDATE.''.$res->DIEDDATE.''.$res->LOCATION.''.$age.'
No Record Found!