-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.php
More file actions
18 lines (15 loc) · 742 Bytes
/
print.php
File metadata and controls
18 lines (15 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
$mysqli = new mysqli("localhost", "root", "root", "world");
if ($mysqli->connect_errno) {
echo "Falló la conexión a MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
if (!$mysqli->query("DROP TABLE IF EXISTS test1") ||
!$mysqli->query("CREATE TABLE test1(id INT, etiqueta CHAR(1))") ||
!$mysqli->query("INSERT INTO test1(id, etiqueta) VALUES (1, 'a')")) {
echo "Falló la creación de la tabla: (" . $mysqli->errno . ") " . $mysqli->error;
}
$resultado = $mysqli->query("SELECT id, etiqueta FROM test1 WHERE id = 1");
$fila = $resultado->fetch_assoc();
printf("id = %s (%s)\n", $fila['id'], gettype($fila['id']));
printf("etiqueta = %s (%s)\n", $fila['etiqueta'], gettype($fila['etiqueta']));
?>