1

Why is this code in php not working to reset the auto_increment value to 1?

$table="week21";
$sql1 = "ALTER TABLE $table AUTO_INCREMENT = 1";
$gereset = mysqli_query($db,$sql1);
yvesmancera
  • 2,915
  • 5
  • 24
  • 33
LUC TERMOTE
  • 27
  • 1
  • 8

1 Answers1

1

The problem is solved, I had placed the code within a if {} so that the "alter table..." could never be reached.

So this code works now:

$sql1 = "ALTER TABLE ".$table." AUTO_INCREMENT = 1";
$gereset = mysqli_query($db,$sql1);

Thanks for the help.

LUC TERMOTE
  • 27
  • 1
  • 8