Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/05/2008, 15:52
Avatar de nuckzuniga
nuckzuniga
 
Fecha de Ingreso: marzo-2008
Mensajes: 71
Antigüedad: 16 años, 10 meses
Puntos: 0
Problema con los querys MySQL

para variar, ando con problemas con los querys. La idea es que mi script muestre los archivos que hay en una carpeta determinada, y que rescate los nosmbres de los usuarios que subieron el archivo de la base de datos.

Si necesitan algo preguntenme nomas ;)

Código PHP:
 <?PHP
$id_user
=$_SESSION["id_usuario"];


$sql_proyecto ="SELECT  a.id_proyecto, p.nombre, e.nombre FROM acceso  AS a left join proyectos AS p ON a.id_proyecto = p.id left join empresa AS e ON e.id=p.id_empresa WHERE  a.id_usuario='$id_user'";
$res_proyecto mysql_query($sql_proyecto,$dbh);
$row_proyecto mysql_fetch_array($res_proyectoMYSQL_NUM);



?>
</p>
<table width="650" border="0" cellspacing="0" style="margin-left:128px">
  <tr>
    <td width="616">
     
      <div align="left" class="style19">
        
        <p align="center">
          <input type="submit" name="Submit" value="Volver al Menu Principal" onClick="location.href='ingreso.php'">
          <input type="submit" name="Submit2" value="Volver al Libro de Obras" onClick="history.back()">
</p>
        <table width="559" border="1">
          
          <tr>
          
            <th width="355" bgcolor="336633" scope="col"><span class="style26">NOMBRE ARCHIVO ADJUNTO </span></th>
            <th width="188" bgcolor="336633" class="style26" scope="col">SUBIDO POR </th>
          </tr>         
          
    </table>  </tr>
</table>







        <?PHP
        $dir 
"./adjuntos/".$p."/";
        
$directorio=opendir($dir); 
while (
$archivo readdir($directorio)){
$user $row_proyecto[3];
   
   
$sql_usuarios "SELECT usuario.nombre, adjuntos.id_usuario FROM usuario, adjuntos WHERE usuario.id = adjuntos.id_usuario";
$res_usuarios mysql_query($sql_usuarios,$dbh) or die(mysql_error());
$row_usuarios mysql_fetch_array($res_usuariosMYSQL_NUM);

?>
        <table width="650" border="0" cellspacing="0" style="margin-left:128px">
  <tr>
    <td width="616">
     
      <div align="left" class="style19">
         <? if($archivo!="." && $archivo!=".."){ ?>
        <table width="559" border="1">
          
          
          
          <tr>
         
            <th width="355" scope="col"><span class="style11">
              <?
    
//$ruta_uno = $row_proyecto[3];
    
    
    
    
$ruta "adjuntos/".$p."/".$archivo;
    echo 
"<strong><a href='$ruta'>".$archivo."</strong>";
    
    
?>
            </span></th>
            <? ?>
            <th width="188" scope="col"><span class="style11">
              <?PHP
if($archivo!="." && $archivo!=".."){
    echo 
"<strong>".$row_usuarios[0]."</a></strong>";
    }
?>
            </span></th>
          </tr>
          
        </table>
    </div>
    <div align="left"></div>
    <div align="left"></div><div align="left"></div></td>
  </tr>
</table>

<?PHP
// fin del while
Que habra de malo :S

Gracias de antemano