I'm working on a larger Project that installs a php interpreter via xampp and mariaDB together with a larger project, containing a database and some php files on a blank windows 10 system.
i got everything running so far, the php server is running on command and the mariadb server seems to be reachable too.
The problem I'm facing lies in the fact that our project (which works perfectly under phpstorm and via command line on ANOTHER SYSTEM) doesn't seem retrieve the table data of our database in this VM.
The connection from inside the php is working and the database itself gets recognized too. I checked that by printing it like this:
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "toor";
$dbname = "emensawerbeseite";
$dbport = "42069";
$link= mysqli_connect ($dbhost, $dbuser, $dbpass,$dbname,$dbport);
if(! $link ) {
die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully</br>';
$link->set_charset("utf8"); //enables the good old äüö's
$db_list = mysqli_query($link, "SHOW DATABASES"); //mysqli
while ($row = mysqli_fetch_object($db_list)) {
echo $row->Database . "</br>";
}
this prints me this output:
I can also list the all table column names.
The database itself I just Copied in the data folder of mariadb. It persists of the same .frm and .ibd and .opt file(s), that my working version has.
Problem lies when i try to insert or retrieve any sort of actual data from the database e.g. like this.
$sql2 = "insert into gericht (id, name, beschreibung, erfasst_am, vegetarisch, vegan, preis_intern, preis_extern) values (22, 'CCurrywurst mit Pommes', '', '2022-11-14', false, false, 4.20, 6.90)";
if ($link->query($sql2) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql2 . "<br>" . $link->error;
}
Which is when the the following Error appears:
"Fatal error: Uncaught mysqli_sql_exception: Table 'emensawerbeseite.gericht' doesn't exist in engine in C:\xampp\php\index.php:43 Stack trace: #0 C:\xampp\php\index.php(43): mysqli->query('insert into ger...') #1 {main} thrown in C:\xampp\php\index.php on line 43"
What does this actually mean?
And what could i do about it? Some Posts suggested to just restart or other things that didn't work.