Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/09/2010, 17:15
ingleonidas
 
Fecha de Ingreso: abril-2010
Mensajes: 87
Antigüedad: 14 años, 7 meses
Puntos: 1
Sonrisa Error de sintaxis, me dan una mano?

Buenas gente, les escribo porque el siguiente codigo me da este error y no me muestra el resultado:
Código HTML:
"); } $sql="select $empdetail.* from $empdetail $rest order by fname"; $result=mysql_query($sql,$connection) or die(mysql_error());	 $num=mysql_num_rows($result); ?>
\n "; $counter++; } if($counter==2) { echo "\n\n\n\n"; $counter=0; } } echo "
=0) { echo "	\n \n \n \n \n \n \n \n \n \n \n \n \n 
Name:	$name\n
Department:	 $depname\n
Gender:	 $gender\n
Date Of Birth:	 $dob\n
View Detail Info\n
\n
  \n
\n"; ?>
Codigo:
Código PHP:
<?
include("conn.php");
$name=$_POST["name"];
$departmentid=$_POST["department"];
$mstatus=trim($_POST["mstatus"]);
$dob=$_POST["dob"];
$wdate=$_POST["wdate"];
$city=$_POST["city"];
$email=$_POST["email"];
$academicid=$_POST["academic"];
$o=$_POST["o"];
                 
$rest="";
                 
$text="Search Keywords : ";
                 
                  if(
$academicid!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.=" inner join $academic on $empdetail.sn=$academic.empid and level='$academicid'";
                                
$text.="Academic = $academicid";
                            }
                            else
                            {
                            
$rest.=" $o  inner join $academic on $empdetail.sn=$academic.empid and level='$academicid'";
                            
$text.=", Academic = $academicid";
                            }
                     }
                     if(
$name!="")
                     {
                         if(
$rest=="")
                            {
                         
$rest.=" where fname like '$name%' or mname like '$name%' or lname like '$name%' ";
                         
$text.="Name like $name ";
                         }
                         else {
                             
$rest.="$o where fname like '$name%' or mname like '$name%' or lname like '$name%' ";
                             
$text.="Name like $name ";
                         }
                     }
                     if(
$departmentid!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.=" where department='$departmentid' ";
                                
$text.="Department = $departmentid";
                            }
                            else
                            {
                            
$rest.=" $o department='$departmentid' ";
                            
$text.=", Department = $departmentid";
                            }
                     }
                     if(
$mstatus!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.="where mstatus='$mstatus' ";
                                
$text.="Marital Staus = $mstatus";
                            }
                            else
                            {
                            
$rest.=" $o mstatus='$mstatus' ";
                            
$text.=", Marital Staus = $mstatus";
                            }
                     }
                     
                      if(
$dob!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.="where dob = '$dob' ";
                                
$text.="Date of Birth = $dob ";
                            }
                            else
                            {
                            
$rest.=" $o  dob = '$dob' ";
                            
$text.=", Date of Birth = $dob ";
                            }
                     }
                     
                     if(
$wdate!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.="where wedding = '$wdate' ";
                                
$text.="Wedding Date = $wdate";
                            }
                            else
                            {
                            
$rest.=" $o  wedding = '$wdate' ";
                            
$text.=", Wedding Date = $wdate";
                            }
                     }
                     if(
$city!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.="where tcity = '$city' ";
                                
$text.="City = $city";
                            }
                            else
                            {
                            
$rest.=" $o  tcity = '$city' ";
                            
$text.=", City = $city";
                            }
                     }
                     
                    
                     
                      if(
$email!="")
                     {
                         if(
$rest=="")
                            {
                                
$rest.="where email like '$email%'";
                                
$text.="Email = $email";
                            }
                            else
                            {
                            
$rest.=" $o email like '$email%' ";
                            
$text.=", Email = $email";
                            }
                     }
                     
                     
                    if(
$rest!="")
                    {
                    
$rest=$rest;
                    }
                    else
                    {
                        
//die("Enter Search Parameter<br><br><br><br><br><br><br><br><br><br><br>");
                    
}

$sql="select $empdetail.* from $empdetail $rest order by fname"
$result=mysql_query($sql,$connection) or die(mysql_error());            
$num=mysql_num_rows($result);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>Wlink Employee Details</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<link href="../../style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../../script.js"> </script>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>

<body>
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  
  <tr>
    <td><hr size="1" noshade></td>
  </tr>
  <tr>
    <td>
      <table width="750" border="0" align="center" cellpadding="2" cellspacing="2">
        <tr>
          <td align="left">
<?
echo "<div align=right>$text</div>";
echo 
"<table width=700 border=0 cellpadding=0 cellspacing=0 align=center>\n
<tr>\n
    <td> Total No of Records Found: $num &nbsp; \n
    <td> &nbsp;\n
    
</tr>\n
<tr> \n"
;
$counter=0;
while(
$row=mysql_fetch_array($result))
{
    
$sn=$row['sn'];
    
$name=$row['fname']." ".$row['mname']." ".$row['lname'];
    
$departmentid=$row['department'];
    
$gender=$row['gender'];
    
$currentAdd=$row['thouseno']." ".$row['tstreet']." ".$row['tcity'];
    
$dob=$row['dob'];
    
$phone=$row['tphno'];
    
$mobile=$row['mobile'];
    
$email=$row['email'];
    
    
$depsql="select depid,depname from $department where depid='$departmentid'";
    
//echo $depsql;
    
$rDep=mysql_query($depsql,$connection) or die(mysql_error());
    while(
$r=mysql_fetch_array($rDep)) {
        
$depname=$r['depname'];
    }
    
    if(
$counter>=0) {
    echo 
"<td valign=top>\n
    <table width=340 border=0 align=left class=allborder> \n
    <tr> \n
        <td width=120> Name:  <td>$name\n
    </tr>\n
        <tr> \n
        <td> Department:  <td> $depname\n
    </tr>\n
        <tr> \n
        <td> Gender:  <td> $gender\n
    </tr>\n
    
        <tr> \n
        <td> Date Of Birth:  <td> $dob\n
    </tr>\n
        
    </tr>\n
        <tr> \n
        <td colspan=2 class=topBorder> <a href=viewdetail.php?sn=$sn>View Detail Info</a>\n
    </tr>\n
    </table>\n</td>\n
     "
;
     
$counter++;
     } 
     if(
$counter==2) {
         echo 
"</tr>\n<tr>\n<td colspn=2>&nbsp; \n</tr>\n<tr>\n";
        
$counter=0;
     }
}
echo 
"</table>\n";
?></td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
</html>