Ver Mensaje Individual
  #6 (permalink)  
Antiguo 23/03/2010, 08:27
etisdemian
 
Fecha de Ingreso: octubre-2009
Mensajes: 357
Antigüedad: 14 años, 6 meses
Puntos: 1
Respuesta: arrays en select y cantidad de opciones en SET de la bd

Esto es lo primero:


Código PHP:
Ver original
  1. <input name="palabra">
  2.  
  3.  
  4. <select name="camposabuscar">
  5.    
  6. / / aqui es el dilema, pues todas no es un campo
  7. // y deviera de contener todasa las demas opciones(autor, titulo, etc)
  8.  
  9. <option value="todas">Editorial</option>  
  10.   <option value="campo_autor">Autor</option>
  11.         <option value="campo_titulo">T&#237;tulo</option>
  12.        <option value="campo_isbn">ISBN</option>
  13.              </select>
  14.  
  15.  
  16.  
  17. $query=("SELECT * , MATCH($camposabuscar) AGAINST ('$palabra') as Score FROM inventario WHERE MATCH($camposabuscar) AGAINST ('$palabra') ORDER BY Score DESC");



Esto es lo segundo:

formulario
Código PHP:
Ver original
  1. <?php
  2. // si el formulario ha sido enviado, convertir subarrays $_POST a strings
  3.  
  4. if (array_key_exists('enviar', $_POST)) {
  5.  
  6.   if (isset($_POST['areas'])) {
  7.     $_POST['areas'] = implode(',', $_POST['areas']);
  8.     }else {
  9.     $_POST['areas'] = '';
  10.     }
  11.  
  12.   }
  13.  
  14. ?>
  15. ___________________________________________________
  16. <tr>
  17. <TD>MEDICOS</TD><td><input name="areas[]" type="checkbox" value="1" />
  18. </td>
  19. </TR>
  20. <tr>
  21. <td>PSICOLOGIA </TD><td><input name="areas[]" type="checkbox" value="2" />
  22. </td>
  23. </TR>
  24. <tr>
  25. <td>TEST PSICOLOGICOS </TD><td><input name="areas[]" type="checkbox" value="3" />
  26. </td>
  27. </TR>
  28. <tr>
  29. <td>
  30. MEDICINA VETERINARIA </TD><td><input name="areas[]" type="checkbox" value="4" />
  31. </td>
  32. </TR>
  33.  
  34. /////la lista es extensa..
  35. ____________________________________________
  36.  
  37.  
  38.  
  39. $insertSQL = sprintf("INSERT INTO reg (areas, nombre) VALUES (%s, %s)",
  40.  
  41.   GetSQLValueString($_POST['areas'], "text"),
  42.    GetSQLValueString($_POST['nombre'], "text"));    
  43. _____________________________________________________________________

en la base de datos

campo=areas
tipo=INT('1', '2','3',.....)



bueno es eso..

hola eulloa

Última edición por etisdemian; 23/03/2010 a las 08:34