This topic is locked
[SOLVED]

TRUNCATE not works

5/17/2021 5:28:59 PM
PHPRunner General questions
A
Andreas G. author

Before login or
login page: Before process or
After logout
it does not work ?!
Where do I have the mistake?
When restarting the exe, created with phprunner, the tables should be emptied.
System:
Win10Pro
xampp x64
localhost
dbname: datensafe
user: root
pasword: none

$sql = "TRUNCATE TABLE `adressen`TRUNCATE TABLE `banken`TRUNCATE TABLE `ec-karten`TRUNCATE TABLE `kreditkarten`TRUNCATE TABLE `mobil`TRUNCATE TABLE `telefonnummern`";

or

$sql = DB::prepareSQL("TRUNCATE `adressen`");
$sql = DB::prepareSQL("TRUNCATE `banken`");
$sql = DB::prepareSQL("TRUNCATE `ec-karten`");
$sql = DB::prepareSQL("TRUNCATE `kreditkarten`");
$sql = DB::prepareSQL("TRUNCATE `mobil`");
$sql = DB::prepareSQL("TRUNCATE `telefonnummern`");

or

$sql = DB::prepareSQL("TRUNCATE TABLE `ec-karten`");
$sql = DB::prepareSQL("TRUNCATE TABLE `kreditkarten`");
$sql = DB::prepareSQL("TRUNCATE TABLE `mobil`");
$sql = DB::prepareSQL("TRUNCATE TABLE `telefonnummern`");
$sql = DB::prepareSQL("TRUNCATE TABLE `adressen`");
$sql = DB::prepareSQL("TRUNCATE TABLE `banken`");
A
Andreas G. author 5/18/2021

Thats how it works
Was late and didn't see my mistake ..

function BeforeProcessLogin($pageObject)
{
$user = "root";
$password = "";
$host = "localhost";
$database= "datensafe";

$connection= mysql_connect ($host, $user, $password);
if (!$connection)
{
die ('Could not connect:' . mysql_error());
}
mysql_select_db($database, $connection);
$truncatetable= mysql_query("TRUNCATE TABLE adressen");
$truncatetable= mysql_query("TRUNCATE TABLE banken");
$truncatetable= mysql_query("TRUNCATE TABLE eckarten");
$truncatetable= mysql_query("TRUNCATE TABLE kreditkarten");
$truncatetable= mysql_query("TRUNCATE TABLE mobil");
$truncatetable= mysql_query("TRUNCATE TABLE telefonnummern");

Is only for test purposes and to learn phprunner and mysql