Autollenado de html with PHP and MySQL

0

I need a page to be filled with the items saved in a database automatically as I mentioned in the header.

When I generate the queries, it gives me an error that says:

  

"Warning   : mysqli_result :: fetch_assoc () expects exactly 0 parameters, 1 given in   C: \ XAMMP \ htdocs \ trough \ formsArtesa \ Catalogodecatalogo.php on line 61 "

I have reviewed and I can not understand why the problem

Deputy MySQL Table and Code:

CREATE TABLE 'producto' (
  'id_pro' int(11) NOT NULL,
  'nombre_pro' varchar(50) COLLATE utf8_spanish_ci NOT NULL,
  'image_pro' varchar(250) COLLATE utf8_spanish_ci NOT NULL,
  'descripcion' varchar(250) COLLATE utf8_spanish_ci NOT NULL,
  'precio' decimal(4,0) NOT NULL,
  'id_user' int(11) NOT NULL,
  'categoria' varchar(50) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;

<!DOCTYPE HTML>
<html>
	<head>
		<title>Artesanías de mi pueblo</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" href="assets/css/main.css" />
        <link rel="stylesheet" href="assets/css/estilo-ctdect.css">
        <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
	</head>
	<body>
			<div id="wrapper">
					<header id="header">
						<div class="inner">
								<a href="catalogo.php" class="logo">
									<span class="symbol"><img src="images/shop.svg" alt="" /></span><span class="title">Artesanías de mi pueblo.</span>
								</a>
								<nav>
									<ul>
										<li><a href="#menu">Menú</a></li>
									</ul>
								</nav>
						</div>
					</header>
					<nav id="menu">
						<h2>Menu</h2>
						<ul>
							<li><a href="../formsArtesa/catalogo.php">Inicio</a></li>
							<li><a href="catalogo.php">Categorías</a></li>
							<li><a href="quienessomos.php">¿Quiénes Somos?</a></li>
                            <hr>
                            <h2><?php 
                    session_start();
                    if (isset($_SESSION['username']))
                        echo $_SESSION['username']; 
                    else
                        header("location: ../index.html");
                ?></h2>
                            <li><a href="agregarproducto.php">Agregar un producto</a></li>
                            <li><a href="artesano.php">Configurar Cuenta</a></li>
                            <li><a href="../poo.php">Cerrar Sesión</a></li>
						</ul>
					</nav>
                <?php 
                                    include '../head.php';
                                    $categoria=$_GET['categoria'];
                                    $query = "SELECT * FROM producto WHERE categoria='$categoria'";
                                    $ejecutar = $con->query($query);                         
                                    ?>
					<div id="main">
						<div class="inner">
                            <div class="contenido">
                                <h1>Catálogo de <?php echo $categoria ?></h1>
                                <p>Número de Articulos: </p>
                                <hr>
                                <div class="contenido-articulo">
                                <?php
                                include '../head.php';
                                $query = "SELECT * FROM producto WHERE categoria='$categoria'";
                                $ejecutar = $con->query($query);
                                while($fila = $ejecutar->fetch_assoc($query)){
                                ?>
                                    <div class="articulo">
                                        <img src="<?php echo $fila['image_pro']; ?>">
                                        <h4><?php echo $fila['nombre_pro']; ?></h4>
                                        <a href="producto.php?cod_producto=<?php echo $fila['id_pro'] ?>">Ver más</a>
                                    </div>
                                <?php } ?>
                                <div class="regresar">
                                    <a href="catalogo.php">Regresar a Catálogo</a>
                                </div>
                            </div>
						</div>
					</div>
					<footer id="footer">
						<div class="inner">
							<section>
								<h2>Contáctanos</h2>
								<form method="post" action="#">
									<div class="field half first">
										<input type="text" name="name" id="name" placeholder="Nombre" />
									</div>
									<div class="field half">
										<input type="email" name="email" id="email" placeholder="Email" />
									</div>
									<div class="field">
										<textarea name="message" id="message" placeholder="Mensaje"></textarea>
									</div>
									<ul class="actions">
										<li><input type="submit" value="Enviar" class="special" /></li>
									</ul>
								</form>
							</section>
							<section>
								<h2>Síguenos en </h2>
								<ul class="icons">
									<li><a href="https://twitter.com/artesa_sv" class="icon style2 fa-twitter"><span class="label">Twitter</span></a></li>
									<li><a href="https://www.facebook.com/Artesan%C3%ADas-de-mi-pueblo-1869465476709706/" class="icon style2 fa-facebook"><span class="label">Facebook</span></a></li>
									<li><a href="https://www.instagram.com/artesa_sv/" class="icon style2 fa-instagram"><span class="label">Instagram</span></a></li>
									<li><a href="#" class="icon style2 fa-phone"><span class="label">Phone</span></a></li>
									<li><a href="#" class="icon style2 fa-envelope-o"><span class="label">Email</span></a></li>
								</ul>
							</section>
							<ul class="copyright">
								<li>&copy; Derechos Reservados 2017</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
							</ul>
						</div>
					</footer>

			</div>
            <script src="assets/css/slider.js"></script>
			<script src="assets/js/jquery.min.js"></script>
			<script src="assets/js/skel.min.js"></script>
			<script src="assets/js/util.js"></script>
			<script src="assets/js/ie/respond.min.js"></script>
			<script src="assets/js/main.js"></script>
            <script src="assets/js/jquery.js"></script>
        <script src="assets/js/jquery.superslides.js"></script>
	</body>
</html>
    
asked by Luis Rivera 10.08.2017 в 05:46
source

1 answer

2

That's the same, if you translate it into Spanish it says that fetch_assoc() expects exactly 0 parameters and you put a parameter inside the function.

It should be fetch_assoc() and not fetch_assoc($query) .

    
answered by 10.08.2017 / 05:56
source