Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/08/2010, 23:14
Avatar de bocho0610
bocho0610
 
Fecha de Ingreso: enero-2010
Ubicación: <? echo "Santiago, Chile"; ?>
Mensajes: 341
Antigüedad: 14 años, 4 meses
Puntos: 26
Crear tabla mysql desde php

tengo el siguiente codigo:

Código PHP:
Ver original
  1. <?php
  2. include('conex.php');
  3. $link=Conectarse();
  4. $basedatos="prueba";
  5. $rut=$_POST['rut'];
  6. $sql="CREATE TABLE $rut(mes VARCHAR(12) NOT NULL PRIMARY KEY, ventas INT NOT NULL, iva_df INT NOT NULL, compras INT NOT NULL, iva_cf INT NOT NULL, ppm INT NOT NULL, ALGO1 INT NOT NULL, ALGO2 INT NOT NULL, ALGO3 INT NOT NULL, ALGO4 INT NOT NULL, ALGO5 INT NOT NULL, iva INT NOT NULL, retenciones INT NOT NULL);";
  7. if (@mysql_db_query($basedatos, $sql, $link)) {
  8. echo "<h2 align='center'>Se a agregado con exito</h2>";
  9. }else{
  10. echo "<h2 align='center'>La tabla ya existe</h2>";
  11. }
  12. ?>

el problema sq crea tablas con palabras, pero no con numeros. Probando con phpmyadmin pude ver que si recibe tablas con numeros, pero desde php no lo hace.
__________________
Sigueme en Twitter!
Septimoarte.cl <-- Un mundo en cine.