I have an website, wich shows information through an SQL Query. This is working just fine, except when one of the parameters is a string with blank spaces.
echo $seminar = $_POST['Seminar'];
echo $start = $_POST['DatumGruppe'];
$prep_stmt = $mysqli->prepare("SELECT `idtermine` FROM `termine`, seminar WHERE termine.seminar = seminar.idseminar AND seminar.name = ? AND termine.start= ? ");
$prep_stmt->bind_param('ss', $seminar, $start);
if (!$prep_stmt->execute())
{
echo 'Error executing!';
}
else
{
$prep_stmt->store_result();
$prep_stmt->bind_result($termin);
if ($prep_stmt->num_rows != 1)
{
echo '<p class="error">Kein passendes Seminar gefunden</p>';
}
while ($prep_stmt->fetch())
{
echo 'ID: '.$termin.'<br>';
}
}
Like i said: when $seminar is something like "Entspannung" its perfectly working. But "Metakognitives Training - Umgang mit Grübeln und Sorgen" isn't working - theres no mistake in the query, it just doesn't find a fitting row. There are no mistakes in the writing, and the same query is working on another website. So I really don't get the problem.
I tried using quotes
echo $seminar = "'".$_POST['Seminar']."'";
which didn't helped eather. I hope you can help.