sax Posted May 5, 2013 Share Posted May 5, 2013 HyI'm trying to execute this query $stmt = $mysqli->prepare("SELECT streamer,content,provider FROM evento,canali WHERE canali.id=evento.idcanale AND evento.titolo LIKE '%?%' OR evento.sottotitolo LIKE '%?%' AND evento.datainizio=2013-02-21;"); $stmt->bind_param('ss',$tok,$tok); $stmt->execute(); $stmt->close(); but I get this error Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement. but to me it seems like the number are the same, you can see how I prepared the statement with 2 arguments to define, and then I passe 2 arguments to add_param, what I'm getting wrong? some has some ideas?thanks daniele New php-forum User Posts: 2 Joined: Fri May 03, 2013 6:48 pm Quote Link to comment Share on other sites More sharing options...
sax Posted May 5, 2013 Author Share Posted May 5, 2013 edit: i'm using xamp 1.8.1 like mysql server!! Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted May 5, 2013 Solution Share Posted May 5, 2013 (edited) I am so not inclined to help you since the only effort you've shown here is that you can copy/paste entire posts from another forum. You didn't even bother to copy only the text. But it's a very easy answer so I will anyway. Bound variables don't work like simple string replacements. If you want to LIKE a field against a bound string then the string has to be the entire expression - %s and all. $tok = "%" . $tok . "%"; AND evento.titolo LIKE ? OR evento.sottotitolo LIKE ? Edited May 5, 2013 by requinix Quote Link to comment Share on other sites More sharing options...
sax Posted May 5, 2013 Author Share Posted May 5, 2013 sorry fot he copy/paste but I posted a couple of days ago on the other forum and nobody answered, and since I couldn't find I answer I changed forum! thanks for the answer, now it seems like it's working Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.