Código PHP:
<?php
include("config.php");
$conexion=conectarse("gerson","gersongps","gerson");
$rs="SELECT * FROM `gerson`.`geocercas` where Nombre='".$tnombre."'";
$result=mysqli_query($conexion,$rs)or die(mysqli_error());
$num1=mysqli_num_rows($result);
while ($row=mysqli_fetch_array($result))
{$rs1="SELECT * FROM units_geofence where geoId='".$row['geoId']."'";
$result1=mysqli_query($conexion,$rs1)or die(mysqli_error());
$num=mysqli_num_rows($result1);
if ($num>=0)
{
while ($row1=mysqli_fetch_array($result1))
{
$rs2="SELECT * FROM units where unitid='".$row1['unitid']."'";
$result2=mysqli_query($conexion,$rs2)or die(mysqli_error());
$row2=mysqli_fetch_array($result2);
$c++;
?>
<tr <? if(($c % 2)==0){ echo "style='background-color:#D4D3A9;'";}else{echo "style='background-color:#A4A37F;'";} ?>>
<th bgcolor="" scope="col"><div align="center"><? echo $row1["unitid"] ?></div></th>
<th bgcolor="" scope="col"><div align="center"><? echo $row2["vehicle"] ?></div></th>
<th bgcolor="" scope="col"><div align="center"><? echo $row["Nombre"] ?></div></th>
<th bgcolor="" scope="col"><div align="center"><? echo $row["empresa"] ?></div></th>
<th bgcolor="" scope="col"><div align="center"><? echo $row2["last_position"] ?></div></th>
</tr>
<?
}
}
}
?>
ahora lo que no se es que codigo le falta para que si en caso de que no encuentre el registro me tire un echo diciendo "no se encontro el registro" caso contrario que haga la consulta como es eso???