Vuelvo a poner el codigo con algunos cambios que funcionan. Me sale un Resource id #4.
Código PHP:
$sql = "SELECT idvendedor, llavesocio, nombrevend, cvesocio, telvend, celvend, emailvend, e.FecAlta, e.fecbaja FROM cat_vendedores";
$idvendedor = $_REQUEST["idvendedor"];
if(!empty($idvendedor))
{
$sql .= " WHERE e.idvendedor = ".$idvendedor;
$resultado1 = mysql_query($sql,$link);
$row1 = mysql_fetch_row($resultado1);
$sql2= "SELECT idarea FROM cat_vendedores WHERE idvendedor = $idvendedor;
$resultado2 = mysql_query($sql2,$link);
$row2 = mysql_fetch_row($resultado2);
$sql3 = "SELECT desc_area FROM areas WHERE id_area = ".$row2[0];
$resultado3 = mysql_query($sql3,$link);
$row3= mysql_fetch_row($resultado3);
}
if(isset($_REQUEST["Busqueda"]))
{
$vUsuario = $_POST["vUsuario"];
$vNombre = $_POST["vNombre"];
$vTelefono = $_POST["vTelefono"];
$vCelular = $_POST["vCelular"];
$vEmail = $_POST["vEmail"];
$vNomArea= $_POST["vNomArea"];
$vBaja = $_POST["vBaja"];
$vAlta = $_POST["vAlta"];
if(empty($idvendedor))
{ $idSQL= "SELECT idvendedor FROM cat_vendedor ";$count=0;$sql .= " WHERE "; if(!empty($vUsuario)) { $count++;if($count>1) $sql .= "AND "; $sql .= " llavesocio LIKE '".$vUsuario."'"; } if(!empty($vNombre)){ $count++;if($count>1) $sql .= " AND ";$sql .= " nombrevend LIKE '".$vNombre."'"; }if(!empty($vContrasenia)){ $count++; if($count>1)$sql .= "AND "; $sql .= " cvesocio LIKE '".$vContrasenia."'"; } if(!empty($vTelefono)){
$count++; if($count>1) $sql .= " AND "; $sql .= "telvend = ".$vTelefono;} if(!empty($vCelular))
{$count++;if($count>1)$sql .= " AND "; $sql .= "celvend = ".$vCelular;}if(!empty($vEmail)) {$count++;if($count>1) $sql .= " AND "; $sql .= "emailvend = '".$vEmail."'"; }
if(!empty($vNomArea)){ $count++;
$sAre = "SELECT id_area FROM areas WHERE desc_area LIKE '".$vNomArea."'";
$reAre = mysql_query($sAre); $roAre = mysql_fetch_row($reAre); if($count>1) $sql .= " AND "; $sql .= "idarea = ".$roAre[0]; }
if(!empty($vBaja)){ $count++; if($count>1) $sql .= " AND "; $sql .= "fecbaja = '".$vBaja."'";} if(!empty($vAlta))
{ $count++;
if($count>1)
$sql .= " AND ";
$sql .= "FecAlta = '".$vAlta."'";
}//11
echo $sql;
}//2
$idSQL .= $sql;
echo $idSQL;
$resultado2 = mysql_query($idSQL,$link);
//header("Refresh: X; URL=www.sitios-asgui.com/crisa/abcEmpleado.php");
}//1
if(!empty($idvendedor)){
$sql .= " WHERE idvendedor=".$idvendedor;
$sql1= "UPDATE cat_vendedores SET ";
$count=0;
if(!empty($vUsuario))
{
$count++;
if($count>1)
$sql1 .= ", ";
$sql1 .= " llavesocio = '".$vUsuario."'";
}
if(!empty($vContrasenia))
{
$count++;
if($count>1)
$sql1 .= ", ";
$sql1 .= " cvesocio = '".$vContrasenia."'";
}
if(!empty($vNombre))
{
$count++;
if($count>1)
$sql1 .= ", ";
$sql1 .= " nombrevend = '".$vNombre."'";
}
if(!empty($vTelefono))
{
$count++;
if($count>1)
$sql1 .= ", ";
$sql1 .= "telvend = ".$vTelefono;
//echo $sql."<br>";
}
if(!empty($vCelular))
{
$count++;
if($count>1)
$sql1 .= ", ";
$sql1 .= "celvend = ".$vCelular;
}
if(!empty($vEmail))
{
$count++;
if($count>1)
$sql1 .= ", ";
$sql1 .= "emailvend = '".$vEmail."'";
}
if(!empty($vNomArea))
{
$count++;
$sAre = "SELECT id_area FROM areas WHERE desc_area = '".$vNomArea."'";
$reAre = mysql_query($sAre);
$roAre = mysql_fetch_row($reAre);
if($count>1)
$sql .= ", ";
$sql .= "idarea = ".$roAre[0];
}
if(!empty($vBaja)){ $count++; if($count>1) $sql1 .= ", "; $sql1 .= "fecbaja = '".$vBaja."'"; } if(!empty($vAlta)) { $count++; if($count>1) $sql1 .= ", "; $sql1 .= "FecAlta = '".$vAlta."'";}$sql1.= " WHERE idvendedor=".$idvendedor;
$resultado1 = mysql_query($sql1,$link);
}
$resultado = mysql_query($sql,$link);
include ("seguridad.php");
require ("clase_mysql.inc.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF8" />
<!--<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />-->
<link rel="stylesheet" type="text/css" media="screen,projection,echo" href="./css/layout1a_setup.css" />
<link rel="stylesheet" type="text/css" media="screen,projection,echo" href="./css/layout1a_text.css" />
<title>Sístema de Facturación Asgui </title>
</head>
<!-- Global IE fix to avoid layout crash when single word size wider than column width -->
<!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->
<body>
<center>
<!-- Main Page Container -->
<div class="page-container">
<!-- For alternative headers START PASTE here -->
<!-- A. HEADER -->
<div class="header">
<!-- A.2 HEADER MIDDLE -->
<div class="header-middle">
<!-- Site message -->
</div>
<!-- A.3 HEADER BOTTOM -->
<div class="header-bottom">
<!-- Navigation Level 2 (Drop-down menus) -->
<div class="nav2">
<p align="right">Usuario: <b><? echo $_SESSION["nombresocio"];?></b> </p>
<? include 'barramenu.php'; ?>
</div>
</div>
</div>
<!-- For alternative headers END PASTE here -->
<!-- B. MAIN -->
<div class="main">
<!-- B.1 MAIN CONTENT -->
<div class="main-content">
<hr class="clear-contentunit" />
<h1 class="block"><center>Usuarios del Sistema</center></h1>
<!-- Comienza código -->
<form method="POST" action="abcEmpleado.php">
<input type="hidden" name="idarea1" value="<?php echo $idarea1; ?>">
<input type="hidden" name="idvendedor" value="<?php echo $idvendedor; ?>">
<table border=0>
<tr>
<th class="top" scope="col" width="90">Usuario</th>
<th><input type="text" name="vUsuario" value = "<?php echo $row1[1]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Nombre</th>
<th><input type="text" name="vNombre" value = "<?php echo $row1[2]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Contraseña</th>
<th><input type="text" name="vContrasenia" value = "<?php echo $row1[3]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Telefono</th>
<th><input type="text" name="vTelefono" value = "<?php echo $row1[4]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Celular</th>
<th><input type="text" name="vCelular" value = "<?php echo $row1[5]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">e-mail</th>
<th><input type="text" name="vEmail" value = "<?php echo $row1[6]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Nombre de Area</th>
<th><input type="text" name="vNomArea" value = "<?php echo $row3[0]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Fecha Alta</th>
<th><input type="text" name="vAlta" value = "<?php echo $row1[7]; ?>" size="100"></td>
</tr>
<tr>
<th class="top" scope="col" width="90">Fecha Baja</th>
<th><input type="text" name="vBaja" value = "<?php echo $row1[8]; ?>" size="100"></td>
</tr>
<tr>
<th></td>
<td align=right><input type="submit" id="Busqueda" name="Busqueda" value="<?php if(!empty($idvendedor)) echo "Modificar"; else echo "Buscar";?>"></td>
</tr>
</table>
</form>
<form method="GET" action="abcEmpleado.php">
<table>
<tr>
<th class="top" scope="col" width="30">ID:</th>
<th class="hpedidotit" scope="col" width="60">Usuario</th>
<th class="hpedidotit" scope="col" width="60">Nombre</th>
<th class="hpedidotit" scope="col" width="60">Contraseña</th>
<th class="hpedidotit" scope="col" width="65">Telefono</th>
<th class="hpedidotit" scope="col" width="70">Celular</th>
<th class="hpedidotit" scope="col" width="130">Email</th>
<th class="hpedidotit" scope="col" width="80">Area</th>
<th class="hpedidotit" scope="col" width="90">Acciones</th>
<th class="hpedidotit" scope="col" width="60">Fecha de Alta</th>
<th class="hpedidotit" scope="col" width="60">Fecha de Baja</th>
</tr>
<?PHP
//var_dump($row=mysql_fetch_row($resultado));
while ($row=mysql_fetch_row($resultado)) // recorre los clientes uno por uno hasta el fin de la tabla
{
$SQLnomArea = 'SELECT desc_area FROM areas WHERE id_area = (SELECT idarea FROM cat_vendedores WHERE idvendedor = '.$row[0].')';
$resultado2 = mysql_query($SQLnomArea,$link);
$fila2=mysql_fetch_row($resultado2);
echo '<tr><td class="'.$clase_celda.'"><a id="id" name="id" href="abcEmpleado.php?idvendedor='.$row[0].'">'.$row[0].'</a></td>';
echo '<td class="'.$clase_celda.'" >'.$row[1].'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[2].'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[3].'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[4].'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[5].'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[6].'</td>';
echo '<td class="'.$clase_celda.'" >'.$fila2[0].'</td>';
echo '<td class="'.$clase_celda.'" >'.''.'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[7].'</td>';
echo '<td class="'.$clase_celda.'" >'.$row[8].'</td>';
}
?>
</table>
</form>
</div>
</div>
</center>
</body>
</html>
<?php
mysql_free_result($resultado);
mysql_free_result($resultado1);
mysql_free_result($resultado2);
mysql_free_result($reAre);
?>