I'm using this method to insert data into my database:
function insertMenue($content, $date) {
$session = $_SESSION['aid'];
global $pdo;
$pdo->exec('SET CHARACTER SET utf8');
$query = $pdo->prepare('INSERT INTO menue(type, content, date, creator) VALUE (?,?,?,?)');
$query->bindValue(1, "menue");
$query->bindValue(2, "<p>" . $content . "</p>");
$query->bindValue(3, $date);
$query->bindValue(4, $session);
$query->execute();
}
I'm calling this method for every object in an array. Now every time when there should be a String which contains an umlaut (ä, ö, ü) the String gets cut off where the umlaut should be.
As for example I'm writing:
<p>Salat<br>Gemüse und Teigwaren</p>
The data in the database happens to be just:
<p>Salat<br>Gem
Now the question is:
How can I print_r() the whole sql statement?
print_r($query->execute());
Would display (1,1,1,1)
and I want something like: (menue, (p)Salat(br)Gemüse und Teigwaren(/p), 2015-09-06, 2)
I'm not sure whether it doesn't get to the database or whether the database is the problem. The db itself can handle umlaute and is written in utf-8. I dumped the file and took a closer look at it, it shouldn't be corrupted.
You cant see the full query, because it doesnt exist in the PHP side.
PHP first sends the query and then the parameters when using prepared statements (Not sure what happens when the emulation mode is on though).
If you want to see the final query, you should enable your database's query log and check there.
This is the closest you can get with just PHP: https://www.php.net/manual/en/pdostatement.debugdumpparams.php