I'm new to PHP. Actually I've just started using it to manage my database for my Android app. So the problem is in case I want to edit an item. I check first if it exists so I can load its info in a new page. Here's the function I used to do it (after Firebase initialization):
function findMovie($database){
$snapshot = $database->getReference('Movies/'.$_POST['movieType'])->getSnapshot();
if ($snapshot->hasChild($_POST['movieName'])) {
header('Location: index.php');
exit;
}
else{
echo '<div class="alert alert-danger" role = "alert" >
<strong>Error!</strong> A movie with the given name, <a href="#" class="alert-link">, cannot be found</a>.
</div >';
echo "Movie Name: ".$_POST['movieName'];
}
}
The problem is if the item has a space in its name, an error occurs:
Fatal error: Uncaught JmesPath\SyntaxErrorException: Syntax error at character 4 The Revenant ^ Did not reach the end of the token stream in...
And it works perfectly if it doesn't!
Here's the path in my database:
I tried with hello, and it works fine... Is there a solution?