Ver Mensaje Individual
  #5 (permalink)  
Antiguo 11/08/2006, 22:08
Avatar de DarkXNightmare
DarkXNightmare
 
Fecha de Ingreso: agosto-2005
Ubicación: Somewhere Over The Rainbo
Mensajes: 181
Antigüedad: 21 años, 2 meses
Puntos: 0
Holas... te tengo un regalito :D!

Código PHP:
$conn = mysql_connect("xxx", "xxx", "xxx");
mysql_select_db("xxx", $conn);
function 
mysql_create_table($table_name, $conn_id = "")
{
    if (
$conn_id == "")
    {
        unset(
$conn_id);
    }
    
$result = !isset($conn_id) ? mysql_query("SHOW TABLES") : mysql_query("SHOW TABLES", $conn_id);
    while (list(
$db_table) = !isset($conn_id) ? mysql_fetch_array($result) : mysql_fetch_array($result, $conn_id))
    {
        if (
$db_table == $table_name)
        {
            return 
false;
            exit;
        }else{
            continue;
        }
    }
    
$sql = "CREATE TABLE {$table_name} (id int(11) NOT NULL auto_increment,
  PRIMARY KEY  (id))"
;
    
$result = !isset($conn_id) ? mysql_query($sql) : mysql_query($sql, $conn_id);
    if (
$result)
    {
        return 
true;
    }else{
        return 
false;
    }
}
if (
mysql_create_table("compadre", $conn))
{
    echo 
"Se creo correctamente";
} 
Ojalá te guste la función ;D...

Atte... DarkXNightmare ;D.
__________________
Cambiando mi Web... sean pacientes :P