<?php
$mysqli = new mysqli("localhost", "user", "password", "agenda");//Objeto
if ($mysqli->connect_errno)
{
echo "Fallo al contenctar a MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$resultado = $mysqli-> query("SELECT * FROM agenda");
echo "<h3>Agenda.</h3>";
echo "<table>";
while ($fila = $resultado->fetch_assoc())
{
echo "<tr>";
echo "<td>".$fila['nombre']."</td>";
echo "<td>".$fila['telefono']."</td>";
echo "</tr>";
}
echo "</table>";
$mysqli -> close();
?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.