Article View: chile.comp.programacion
Article #2821Re: verificar si existe una tabla
From: David Az�car
Date: Tue, 27 Sep 2005 00:05
Date: Tue, 27 Sep 2005 00:05
38 lines
2274 bytes
2274 bytes
Vinko Vrsalovic <el@vinko.invalid> wrote:
> David Az�car <dazocar@nospaming.uchile.cl> dijo:
>> hola, quisiera preguntar c�mo puedo hacer un par de l�neas de php para
>> verificar si existe una tabla en una base de datos mysql, o sea lo que
>> pens� yo es leer la primera l�nea y ver si me sale error, pero si es que
>> existe, ya habr�a le�do una l�nea... me gustar�a usar una soluci�n m�s
>> "elegante".
>>
>> gracias por la ayuda
>
> No hay para que seleccionar datos de la supuesta tabla.
> select 1 from Tabla_Inexistente limit 1
> ERROR: bd.Tabla_Inexistente does not exist
> select 1 from Tabla_Existente limit 1
> 1
> 1
> Otra opcion, la 'correcta', seria ejecutar "show tables",
> que es la forma (horraible) de obtener los metadatos
> respecto a las tablas existentes en una base de datos en mysql.
Ya solucion� ese problema, pero tengo otro: c�mo hago para que esa l�nea de
error no se imprima en la pantalla? prob� haciendo
ini_set("display_errors",false)
pero no me funka, hay alguna forma m�s simple? onda redireccionar a /dev/null
o algo por el estilo
gracias
> --
> V.
--
David Az�car P.
Technical Details
Message-ID:
<dha2bh$m6p$1@localhost.localdomain>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.cec.uchile.cl!not-for-mailReferences:
<dh8tvg$7ih$2@localhost.localdomain> <4337fb6f@news.vcd.cl>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,a17a2f6160663a86
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.cec.uchile.cl!not-for-mail
From: David Az�car <dazocar@NOSPAMing.uchile.cl>
Newsgroups: chile.comp.programacion
Subject: Re: verificar si existe una tabla
Date: Tue, 27 Sep 2005 00:05:05 +0000 (UTC)
Organization: Ingenier�a - U de Chile
Lines: 38
Sender: AZOCAR PAREDES DAVID IGNACIO <dazocar@cipres.cec.uchile.cl>
Message-ID: <dha2bh$m6p$1@localhost.localdomain>
References: <dh8tvg$7ih$2@localhost.localdomain> <4337fb6f@news.vcd.cl>
NNTP-Posting-Host: cipres.cec.uchile.cl
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: localhost.localdomain 1127779505 22745 200.9.100.5 (27 Sep 2005 00:05:05 GMT)
X-Complaints-To: news@localhost.localdomain
NNTP-Posting-Date: Tue, 27 Sep 2005 00:05:05 +0000 (UTC)
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (SunOS/5.8 (sun4u))