Código PHP:
Ver original
<html> <head> <title>Creación</title> </head> <body> <?php echo "<p align=center>"; echo "A continuación se muestra ."; $host = "localhost"; $usuario = "root"; // Cambiar por su nombre de usuario. $password = "root"; // Cambiar por su password. $consulta = "SELECT * FROM producto"; echo "<table align=center border=1 bgcolor=#6B6BFF cellspacing=5>"; echo "<tr>"; echo "<br>"; foreach($reg as $cambia){ echo "<td>",$cambia,"</td>"; } } ?> </html>
Pero ahora prueba a separarlo, tengo por un lado index.php
Código PHP:
Ver original
<?php include ('prueba.php'); echo "hola"; do_html_header(); ?>
y por otro lado prueba.php
Código PHP:
Ver original
<?php function do_html_header(){?> <html> <head> <link rel="stylesheet" href="div.css"> </head> <body> <div class="round2"> <div class="round">Prueba<hr></div> <?php do_categorias(); ?> </div> </body> </html> <?php} function do_categorias(){ echo "<p align=center>"; echo "<p>Por favor elija una categoría:</p>"; $conn = do_conexion(); $consulta = "SELECT * FROM producto"; echo "<table align=center border=1 bgcolor=#6B6BFF>"; echo "<tr>"; echo "<br>"; foreach($reg as $cambia){ echo "<td>",$cambia,"</td>"; } echo "</tr></table>"; } } function do_conexion(){ $host = "localhost"; $usuario = "root"; $password = "root"; return $conectar; } ?>
pero esto me falla? alguna ayuda?
Gracias