Re: : [PHP-ES] Recoger errores de la base de datos.
| From: | Pablo Braulio | Date: | Tue, 18 Dec 2007 21:17:55 +0000 |
| Subject: | Re: : [PHP-ES] Recoger errores de la base de datos. | ||
| References: | 1 2 3 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-61988@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Camilo Uran escribió:
> Creo que Pablo había dicho que usaba postgres, con lo cual las funciones
> mysqli no le sirven de mucho XD
> De todas formas, pablo, aquí te dejo una buena lista de artículos que
> -creo- te serviran:
>
> http://www.google.es/search?hl=ca&q=errores+postgresql
>
> <http://www.google.es/search?hl=ca&q=errores+postgresql>
Autocontesto:
De momento se me ocurre esto:
<?php
/*
* Created on 18/12/2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
error_reporting(E_ERROR);
require('/home/pablo/conexion.php');
function error($valor){ ?>
<table border="1" width="500">
<tr>
<td style="color: red;">SE HA PRODUCIDO UN ERROR.</td>
<td><?php echo $valor; ?></td>
</tr>
</table>
<?php
}
$select= "sele * from clientes";
$query= pg_query($select) or die(error(pg_last_error()));
$row= pg_fetch_array($query);
echo $row;
?>
Se puede mejorar, con una clase, haciendo la tabla mas bonita, etc. Pero
creo que la idea queda clara.
El objetivo es recoger errores de los inserts, update, select y delete.
- --
< ¡¡Nos vemos!! >
----------------------------
\
\
.::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW$$$
:$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P
$$$$$##WX!: .<!!!!UW$$$$" $$$$$$$$#
$$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$*
^$$$B $$$$\ $$$$$$$$$$$$ d$$R"
"*$bd$$$$ '*$$$$$$$$$$$o+#"
"""" """""""
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHaDkDK7lGsMchFswRAmdrAJ4wBT5Gj0QXt/wI7ZYF8HI9d8WAkACfZbyC
DaVDPo7IPG6ykh6LyGbvFjs=
=Abd2
-----END PGP SIGNATURE-----