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

pateketrueke: a tu pedido, describo un poco mas la situacion... (cosa necesaria)
Es un buscador avanzado, donde mediante 3 bases realizo consultas... Las bases son:
Código:
CREATE TABLE `emp_academic` (
  `sn` int(11) NOT NULL auto_increment,
  `empid` int(11) default NULL,
  `year` varchar(20) default NULL,
  `level` varchar(40) default NULL,
  `university` varchar(50) default NULL,
  PRIMARY KEY  (`sn`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1180 ;
Código:
CREATE TABLE `emp_department` (
  `depid` int(11) NOT NULL auto_increment,
  `depname` varchar(50) NOT NULL default '',
  `sort_order` varchar(5) NOT NULL default '0',
  PRIMARY KEY  (`depid`)
) 
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12
Código:
CREATE TABLE `emp_empdetail` (
  `sn` int(11) NOT NULL auto_increment,
  `empid` int(11) default NULL,
  `department` varchar(50) default NULL,
  `lname` varchar(30) default NULL,
  `fname` varchar(30) default NULL,
  `mname` varchar(30) default NULL,
  
  `gender` varchar(7) default NULL,
  `mstatus` varchar(15) default NULL,
  `wedding` varchar(30) default NULL,
  `dob` date default NULL,
  `tcity` varchar(40) default NULL,
  `email` varchar(50) default NULL,
  PRIMARY KEY  (`sn`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=167 ;
y el buscador es:
Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>Employee Details</title>

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



<style type="text/css">
<!--
.style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
.style10 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; }
.style11 {font-size: 11px}
.style4 {font-size: 12px; font-family: Arial, Helvetica, sans-serif; font-weight:100; }
.style5 {	color: #FFFFFF;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: bold;
}
-->
</style>

<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="775" border="0" align="center" cellpadding="0" cellspacing="0">
        
        <tr>
          <td><form name="form1" method="post" action="showreport2.php">
            <table width="550" border="0" align="center" cellpadding="1" cellspacing="2">
              <tr>
                <td width="205"><span class="style10">By Name </span></td>
              <td width="335"><input name="name" type="text" id="name"></td>
            </tr>
              <tr>
                <td><span class="style10">By Department</span></td>
              <td><span class="style7">
                <span class="style4">
                  <select name="department">
                    <option value="">-- Select Department -- </option>
                    <?
			 	include("conn.php");
				$sql="select depid,depname from $department order by depid";
				$result=mysql_query($sql,$connection) or die(mysql_error());
				while($row=mysql_fetch_array($result))
				{
					
			   ?>
                    <option value="<? echo $row['depid'] ?>"><? echo $row['depname']; ?> </option>
                    <? } ?>
                    </select>
                  </span> </span></td>
            </tr>
              <tr>
                <td><span class="style10">By Marital Status </span></td>
              <td><span class="style7">
                <select name="mstatus" id="mstatus">
                  <option value="">---Select Marital Status---</option>
                  <option value="Married">Married</option>
                  <option value="Unmarried">Unmarried</option>
                  </select>
                </span></td>
            </tr>
              <tr>
                <td><span class="style10">By Date of Birth </span></td>
              <td><input name="dob" type="text" id="dob"></td>
            </tr>
              <tr>
                <td><span class="style10">By Wedding Date </span></td>
              <td><input name="wdate" type="text" id="wdate"></td>
            </tr>
              <tr>
                <td class="style10">By City </td>
              <td><span class="style4">
                <select name="city" id="city">
                  <option value="">Select City </option>
                  <option value="Kathmandu">Kathmandu</option>
                  <option value="Lalitpur">Lalitpur</option>
                  <option value="Bhaktapur">Bhaktapur</option>
                  </select>
                </span></td>
            </tr>
              <tr>
                <td><span class="style10">By Academic Levels </span></td>
              <td><select name="academic" id="academic">
                <option value="">Select Academic Level </option>
                <option value="High School">High School</option>
                <option value="School Level">School Level</option>
                <option value="Bachelor in Eng">Bachelor in Eng</option>
                <option value="Bachelor">Bachelor</option>
                <option value="Master">Master</option>
                </select></td>
            </tr>
              <tr>
                <td><span class="style10">By Email Address </span></td>
              <td><input name="email" type="text" id="email"></td>
            </tr>
              <tr>
                <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
              <tr>
                <td><span class="style10"><strong>Criteria</strong></span></td>
              <td><span class="style7">
                <select name="o" id="o">
                  <option value="AND">AND</option>
                  <option value="OR">OR</option>
                  </select>
                </span></td>
            </tr>
              <tr>
                <td><span class="style11"></span></td>
              <td>&nbsp;</td>
            </tr>
              <tr>
                <td colspan="2"><input name="Submit" type="submit" value="          Generate  Report           "></td>
            </tr>
              </table>
      </form></td>
    </tr>
      </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>