Article View: chile.comp.programacion
Article #2818Re: verificar si existe una tabla
From: Vinko Vrsalovic
Date: Mon, 26 Sep 2005 14:45
Date: Mon, 26 Sep 2005 14:45
26 lines
1747 bytes
1747 bytes
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. -- V.
Technical Details
Message-ID:
<4337fb6f@news.vcd.cl>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.vcd.cl!not-for-mail!not-for-mailReferences:
<dh8tvg$7ih$2@localhost.localdomain>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,a17a2f6160663a86
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Message-ID: <4337fb6f@news.vcd.cl>
From: Vinko Vrsalovic <el@vinko.invalid>
Subject: Re: verificar si existe una tabla
Newsgroups: chile.comp.programacion
References: <dh8tvg$7ih$2@localhost.localdomain>
User-Agent: tin/1.7.6-20040906 ("Baleshare") (UNIX) (Linux/2.6.10-5-386 (i686))
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 200.73.29.150
X-Original-NNTP-Posting-Host: 200.73.29.150
Date: 26 Sep 2005 10:45:21 -0400
X-Trace: news.vcd.cl!not-for-mail 1127742321 200.73.29.150 (26 Sep 2005 10:45:21 -0400)
X-Original-Trace: 26 Sep 2005 10:45:21 -0400, 200.73.29.150
Lines: 26
X-Authenticated-User: vinko
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.vcd.cl!not-for-mail!not-for-mail