Bonjour j'utilise une fonction pour vider une table, mais j'aimerais aller plus loin en vidant ma table sauf les id de 1 à 10.

Pouvez-vous m'aider?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
function vider_table3($table_a_vider3){
    $sql  = "TRUNCATE TABLE ".$table_a_vider3; 
    mysql_query($sql);
 
    if(mysql_query($sql))
      // SUCCES
      echo "La table ".$table_a_vider3." a été vidée !"; 
    else
      // ECHEC
      echo "La table ".$table_a_vider3." n'a pas été vidée de son contenu.";
  }
  // ON VIDE $table_a_vider
  vider_table3($table_a_vider3);