Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/06/2016, 12:03
Avatar de manuparquegiralda
manuparquegiralda
 
Fecha de Ingreso: junio-2012
Ubicación: Barcelona
Mensajes: 241
Antigüedad: 12 años, 8 meses
Puntos: 39
Respuesta: Pdo::fetch_assoc

¿Y porque no pruebas a hacerlo a través de la clase mysli a ver que resultado te da?

Código PHP:
Ver original
  1. <?php
  2.  
  3. /* CONEXIÓN A LA BASE DE DATOS */
  4. $mysqli = new mysqli("localhost", "root", "", "pruebas");
  5. $mysqli->set_charset("utf8");
  6. if($mysqli->connect_errno){
  7.     echo $mysqli->error;
  8.     die();
  9. }
  10.  
  11. /* POSTEAMOS DATOS */
  12. $articulo=$_POST["nombre"];
  13. $pais=$_POST["pais"];
  14.  
  15. /* CONSULTA LA BASE DE DATOS */
  16. $consulta = $mysqli->query("SELECT NOMBREARTÍCULO,SECCIÓN,PRECIO,PAÍSDEORIGEN FROM PRODUCTOS WHERE NOMBREARTÍCULO = '".$articulo."' AND PAÍSDEORIGEN = '".$pais."'");
  17.  
  18. /* SACAMOS EL LISTADO DE ARTÍCULOS */
  19. $listado = "";
  20. while($resultado = $consulta->fetch_assoc()){
  21.     $listado .= "Nombre Artículo: ".$resultado['NOMBREARTÍCULO']." Sección: ".$resultado['SECCIÓN']." Precio ".$resultado['PRECIO']." País de Origen ".$resultado['PAÍSDEORIGEN']."<br>";
  22. }
  23.  
  24. /* IMPRIMIMOS EL RESULTADO */
  25. if(!$listado){
  26.     echo "El artículo no existe";
  27. }else{
  28.     echo $listado;
  29. }
  30.  
  31. ?>
__________________
Diseño Web - Arisman Web