I'm trying to alter an SQL query to the LIKE-type which involves adding the '%' at the end. After some digging around I learned that I need to make use of SetString somehow. Like this (this seems to be JAVA):
pstmt.setString(1, notes + "%");
I'm not really sure how to incorporate this in my code though:
$query = 'SELECT DISTINCT ... LEFT JOIN ... ON ... WHERE bedrijfsnaam = ?';
$stmt->prepare($query);
$stmt->bind_param('sii', $bedrijfvariabele2, $startpoint, $limit);
$stmt->execute();
Not sure how to alter the setString to incoroporate with my PHP?
So far we've got this:
$query = 'SELECT DISTINCT ... LEFT JOIN ... ON ... WHERE bedrijfsnaam LIKE ?';
$stmt->prepare($query);
$stmt->bind_param('sii', "$bedrijfvariabele2%", $startpoint, $limit);
$stmt->execute();
This however, produces a blank page starting from the point of this code.
The final solution in my case was adding the % icon JUST before binding the paramaters.
$bedrijfvariabele2 .= "%";
$stmt->bind_param('sii', $bedrijfvariabele2, $startpoint, $limit);
Thanks a lot!