tengo un problema con php, cuando valido los usuarios q estan guardados en una base sql quiero q se filtre solo la informacion q esos usuarios tienen q no puedan ver las de los demas el problema s cuando hago l llamado y selecciono no me muestra nada no se que estara mal.... ayuuuuuuudaaaaa
este es donde se deberian filtrar los datos ya q existe una tabla llamada empresas con un campo codigo y otra noticias donde stan los trabajadores con un campo codigo igual, pero cuando hago l filtro entre las 2 tblas no me muestra nada...
<html>
<head>
<title>MOSTRANDO NOTICIAS POR: Gino'FL</title>
<style type="text/css">
<!--
.Estilo1 {color: #0066CC}
-->
</style>
</head>
<body>
<?
//include ("aut.php");
//conecto con la base de datos
$db = mysql_connect ("69.16.233.63","vargas_web","conexsis1");
if(!$db)
{
die("fallo".mysql_error());
}
//mysql_select_db ("greciacr_bravo",$db);
$seleccionar_db = mysql_select_db ("vargas_padron",$db);
if (!$seleccionar_db)
{
die("Fallo la selección de la Base de Datos: " . mysql_error());
}
$codigo = $_GET[codigo];
/* $codigo = "$codigo";
function A()
{
global $codigo;
$codigo = "$codigo";
}*/
/* if (permisos($empresa_u,'add'){
echo "<input type'salir' .... />";
}else{
echo "<input type'salir' DISABLED.... />";
}*/
/*Para Enlaces p.e.
if (permisos($user,'del'){
echo "<a href='...'>Borrar</a>";
}else{
echo "<font style='color:#un color que intuya disabled'>Borrar</font>";
}*/
//function getCategoriasDAO(){
//global $db;
//$conn = mysql_connect("servidor","usuario","password");
//mysql_select_db("basededatos",$conn);
//Hacemos el Select
//$ssql = "SELECT * FROM noticias" ;
//$ssql = "SELECT * FROM noticias INNER JOIN empresa ON (noticias.codigo=empresa.codigo) WHERE (noticias.codigo=" ".mysql_escape_string($_POST['$codigo'])." ;
// mae progra $ssql = "SELECT * FROM noticias INNER JOIN empresa ON (noticias.codigo=empresa.codigo) WHERE (noticias.codigo=".$codigo.")";
//$ssql = "SELECT * FROM noticias INNER JOIN empresa ON (noticias.codigo=empresa.codigo) WHERE (noticias.codigo IN ['$codigo'])";
$ssql = "SELECT * FROM noticias INNER JOIN empresa ON (noticias.codigo = empresa.codigo) WHERE (noticias.codigo AND empresa.codigo LIKE '".$codigo."')";
//Ordenamos las Noticias para que se vean las mas recientes
//$ssql .= " ORDER BY id desc";
//tomo el juego de resultados
$resultid = mysql_query($ssql,$db) or die( mysql_error() );
?>
<table border="0" cellpadding="0" cellspacing="0" style width="100%" id="AutoNumber1">
<tr>
<td width="20%"> </td>
<td width="60%" colspan="3">
<p align="center"><b><font face="Arial Black" size="4">MOSTRANDO PERSONAL </font></b></td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"><label><?php echo "$codigo";?>
<input name="textfield" type="text">
</label></td>
<td width="60%" colspan="3">
<?
//muestro los datos en un bucle
//$categorias = array();
$num_filas = 0;
while ($damefila=mysql_fetch_object($resultid))
{
//array_push($categorias,$damefila);
?>
<table border="1" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber2" style="border-left: .75pt solid black; border-right: .75pt solid black; border-top: 1.5pt solid black; border-bottom: 1.5pt solid black">
<tr>
<td width="76%" align="center" valign="middle" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: .75pt solid black; background-color: #B4B4CA">
<font face="Arial" size="2" color="#000000"><?echo strip_tags($damefila->titulo)?> <?echo strip_tags($damefila->mensaje)?> <?echo strip_tags($damefila->mensaje2)?> &n bsp; &nbs p; &n bsp; &nbs p; &n bsp; Codigo:<?echo strip_tags($damefila->codigo)?></font></td>
<td width="24%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: .75pt solid black; background-color: #B4B4CA">
<p align="right">
<font face="Arial" size="2"><?echo strip_tags($damefila->fecha)?></font></td>
</tr>
<tr>
<td width="76%" style="font-weight: bold; color: black; border-style: none; background-color: white" valign="top">
<p><font face="Arial" size="2"><span class="Estilo1">Cedula #</span> <?echo strip_tags($damefila->mensaje3)?></font></p>
<p><span class="Estilo1">Descripcion:</span> <?echo strip_tags($damefila->textarea)?></font></p>
<p><span class="Estilo1">Localizacion:</span> <?echo strip_tags($damefila->loca)?></p></td>
<td width="24%" style="color: black; border-style: none; background-color: white" valign="top">
<p align="center">
<img border="0" src="fotos/<?echo strip_tags($damefila->foto)?>" width="99" height="99" align="right"></td>
</tr>
</table>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<?
$num_filas++;
} //termina el bucle while
//return $categorias;
//}
?>
</td>
<td width="20%"> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style width="100%" id="AutoNumber3">
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%">
<p align="center"><b><font face="Arial" color="#FF0000">
<a href="formulario.php">Nuevo Ingreso </a></font></b></td>
</tr>
<tr>
<td width="100%" align="center"><form name="form1" method="post" action="index7.php">
<label>
<input name="salir" type="submit" id="salir" value="salir">
</label>
</form></td>
</tr>
<tr>
<td width="100%">
<p align="center"><b><font face="Arial" color="#FF0000"> Email:
[email protected]</font></b></td>
</tr>
</table>
<p> </p>
</body>
</html>