Ver Mensaje Individual
  #15 (permalink)  
Antiguo 02/01/2012, 07:16
Avatar de Patriarka
Patriarka
 
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 14 años
Puntos: 288
Respuesta: Imagenes campo MYSQL

a ver, no se que estructura huciste. yo te recuerdo la que te enseñe:!!!

NOTICIAS
id_noticia AUTOINCREMENT
name_noticia

FOTOS
id_foto AUTOINCREMENT
url_foto

NOTOCIAS_FOTO
id_noticia
id_foto

Y te dije como programarlo:

Creo la noticia y le agrego las imagenes que quiero.
algo asi
form.html
Código HTML:
Ver original
  1. <form action="procesa.php">
  2. <input name="name_noticia" value="" type="text">
  3.  
  4. <input name="image_noticia[]"  type="file">
  5. <input name="image_noticia[]"  type="file">
  6. <input name="image_noticia[]"  type="file">
  7. <input name="image_noticia[]"  type="file">
  8. //n imagenes, si queres lo podes poner en un for
  9. </form>

procesa.php
Código PHP:
Ver original
  1. $name_noticia = $_REQUEST['name_noticia'];
  2. $sql_noticia ="INSERT INTO NOTICIAS (name_noticia) values ('$name_noticia') ";
  3.  
  4. $id_noticia = mysql_insert_id();
  5.  
  6. //ACA EXPLICO COMO SUBIR MULTIPLES IMEGENES [url]http://www.forosdelweb.com/f18/problema-subir-multiples-imagenes-966309/[/url]
  7.  
  8. WHILE($files){
  9.     $sql_fotos = INSERT INTO FOTOS (url_foto) VALUES ('$_FILES[....]') ;
  10.  
  11.     $id_foto = mysql_insert_id()
  12.  
  13.     $sql_noti_foto = "INSERT INTO NOTICIAS_FOTO (id_noticia, id_foto) VALUES ('$id_noticia ', '$id_foto')";
  14. }

Y bueno ejecuta todas las consultas
y tambien termina de adaptarlo a tu sistema hasta hacer lo funcionar, cuando hagas esto
recien vamos a hablar de "como?" le presentamos al cliente los datos y como relacionamos
las noticas con las fotos, ect, etc.

como ves esto de crear una galeria para un noticiero no es algo que lleva su tiempo