Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/12/2006, 09:55
choco_cu
 
Fecha de Ingreso: mayo-2004
Ubicación: Ciudad de la Habana
Mensajes: 85
Antigüedad: 20 años
Puntos: 0
Pregunta problema para mostrar imagen desde una base de datos con php

Hola, tengo el siguiente problema envie la url de una imagen para mi base de datos pero cuando la llamo en la pagina que quiero mostrarla lo que me sale es el campo de imagen vacio aqui les envio el codigo de la pagina donde deseo mostrar la imagen y el de subida de la imagen a la base de datos a ver si me pueden ayudar.

Código PHP:
<?php //modulo de subida de imagenes al servidor.
if (isset($_POST['send'])){
 if (
$_FILES['url_i']['size'] > $_POST['max_size']*1024){ /*comprobamos que el tamaño sea el permitido*/
 
echo 'el archivo es demasiado grande'; } elseif (($_FILES['url_i']['type']=='image/gif')||($_FILES['url_i']['type']=='image/pjpeg')){ if(is_uploaded_file($_FILES['url_i']['tmp_name'])) { // verifica haya sido cargado el archivo 
    
if(move_uploaded_file($_FILES['url_i']['tmp_name'], '../img/'.$_POST['pos'].'/'.$_FILES['url_i']['name'])) { // se coloca en su lugar final 
                    
echo "<b>Upload exitoso!. Datos:</b><br>"
            echo 
"Nombre: <i><a href=\"".$_FILES['url_i']['name']."\">".$_FILES['url_i']['name']."</a></i><br>"
            echo 
"Tipo MIME: <i>".$_FILES['url_i']['type']."</i><br>"
                    echo 
"Peso: <i>".$res[0]." Kbytes</i><br>"
                        echo 
"<br><hr><br>"
                        
$dir '../img/'.$_POST['pos'].'/';
                        echo 
'la url es'.$dir
        } 
    } 
    }
}
?><?php
if ($_SESSION['MM_Username']=='webmaster'){ $len ='es';
} elseif(
$_SESSION['MM_Username']=='tingles'){ $len ='en';
} else { 
$len ='fr';
}
$maxRows_noticias 5;
$pageNum_noticias 0;
if (isset(
$_GET['pageNum_noticias'])) {
  
$pageNum_noticias $_GET['pageNum_noticias'];
}
$startRow_noticias $pageNum_noticias $maxRows_noticias;

$query_noticias "SELECT * FROM noticias WHERE lang = '$len' ORDER BY id_not DESC";
$query_limit_noticias sprintf("%s LIMIT %d, %d"$query_noticias$startRow_noticias$maxRows_noticias);
$noticias mysql_query($query_limit_noticias$cha) or die(mysql_error());
$row_noticias mysql_fetch_assoc($noticias);
$row_noticias_num mysql_num_rows($noticias);

if (isset(
$_GET['totalRows_noticias'])) {
  
$totalRows_noticias $_GET['totalRows_noticias'];
} else {
  
$all_noticias mysql_query($query_noticias);
  
$totalRows_noticias mysql_num_rows($all_noticias);
}
$totalPages_noticias ceil($totalRows_noticias/$maxRows_noticias)-1;
?>
<?
// modulo de envio
 
if(empty($_POST['titular'])){
   
$tit_e ' Campo vacio';
   } elseif(empty(
$_POST['breve'])){
         
$bre_e 'Campo vacio';} elseif(empty($_POST['noticia'])){
             
$not_e 'Campo vacio'; } else {
     if ((isset(
$_POST['send'])) && ($_POST['send']=='enviar')){
    
$h_pub $_POST['h_pub'];
    
$f_pub $_POST['f_pub'];
    
$tit $_POST['titular'];
    
$bre $_POST['breve'];
    
$not $_POST['noticia'];
    
$ido $_POST['ido'];
    
$fue $_POST['fuente'];
    
$pos $_POST['pos'];
    
$url_i $dir;
    echo 
$f_pub;
    
$sql "INSERT INTO `noticias` ( titular , breve , noticia , url_i , pos , fuente , f_pub , h_pub , lang ) values ('$tit','$bre','$not','$url_im','$pos','$fue','$f_pub','$h_pub','$ido')";
     
mysql_query($sql,$cha);
     }
 }
?>
Código PHP:
<?php
//aqui selecion la base de datos y hago la consulta
mysql_select_db($database_cha$cha);
$query_noti "SELECT * FROM noticias WHERE id_not ='$id'  and lang = '$lang'";
$noti mysql_query($query_noti$cha) or die(mysql_error());
$row_noti mysql_fetch_assoc($noti);
$totalRows_noti mysql_num_rows($noti);
?><? //a continuacion va la tabla donde deseo mostrar los campos de la noticia que envie?><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20" valign="top"><?php echo ucwords(nl2br($row_noti['pos'])); ?></td>
  </tr>
  <tr>
    <td height="10" valign="top"></td>
  </tr>
  <tr>
    <td height="218" valign="top">
      <p><img src="<? printf($row_noti['url_im']); ?>" alt="foto" hspace="3" vspace="3" align="right" style="border-bottom-color:#C8C8C8; border-right-color:#c8c8c8; border-bottom-width:3px; border-right-width:3px; border-bottom-style:groove; border-right-style:groove" /><?php echo ucfirst(nl2br($row_noti['titular'])); ?><br />
        <br />
        <?php echo ucfirst(nl2br($row_noti['noticia'])); ?><br />
        <br />
        <?php echo ucwords(nl2br($row_noti['fuente'])); ?><br />

        <?php echo $row_noti['f_pub']; ?>
        <?php echo $row_noti['h_pub']; ?>
    <hr style="border-style:dotted; border-width:thin; border-color:#CCCCCC"><div align="right" style="color:#7DACF2; text-decoration:none;"><font><a href="javascript:history.go(-1)">atr&aacute;s</a></font></div></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result
($noti);
?>
Muchas gracias de antemano