Cita:
Iniciado por andresdzphp
No es nueva, existe desde PHP 5.1
Con mysql_* es casi lo mismo, consulta con mysql_query, sacas resultado con mysql_fetch_row o _assoc y compruebas:
Código PHP:
Ver originalif ($res[0]) {
echo 'Existe';
} else {
echo 'No existe';
}
Me funciono asi
$id = (int) $_GET['id'];
$stml=mysql_query("select count(id) from imagenes where id = $id");
$res = (mysql_fetch_row($stml));
if ($res[0]) {
echo 'Existe';
} else {
echo 'No existe';
}
ya que con
la clase PDO me saco este error
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in A:\AppServ\www\galeria\imagen.php:75 Stack trace: #0 A:\AppServ\www\galeria\imagen.php(75): PDO->__construct('mysql:host=loca...', 'root', 'password') #1 {main} thrown in A:\AppServ\www\galeria\imagen.php on line