• User

    cancellare campi db

    ciao a tutti. vorrei fare un bottone "empty db" che appunto cancelli tutti i dati contenuti nel db.

    il db l'ho creato così:

    
    <?php
    
    /**
     * @author Ceorge
     * @copyright 2008
     */
    include("configdb.inc.php");
    $db = mysql_connect($db_host, $db_user, $db_password);
    if ($db == FALSE)
    die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
    mysql_select_db($db_name, $db)
    or die ("Errore nella selezione del database. Verificare i parametri nel file config.inc.php");
    $query = "CREATE TABLE new (id INT (5) UNSIGNED not null AUTO_INCREMENT , numero INT (2) UNSIGNED not null , colore VARCHAR (255) not null , colonna INT (1) not null , gruppo INT (1) not null , pd VARCHAR (255) not null , posizione VARCHAR (255) not null , PRIMARY KEY (id))";
    if (mysql_query($query, $db))
    echo "L'installazione è stata eseguita correttamente";
    else
    echo "Errore durante l'installazione";
    mysql_close($db);
    ?>
    
    ```grazie in anticipo

  • User Attivo

    [PHP]
    $sql = "TRUNCATE TABLE new";

    $azione = mysql_query($sql)or die(mysql_error());
    [/PHP]