Chuks Posted October 2, 2019 Share Posted October 2, 2019 I was trying to use Ajax to to communicate with the server while a user types characters in the input field. After creating the HTML code, and the PHP file, on testing it I got the error message: "Warning: stristr(): empty needle in C:\wamp\www\php\revision\ajax\gethint.phponline 50". I don't understand or know how to get around the error. Please help ( ! ) Warning: stristr(): Empty needle in C:\wamp\www\php\revision\ajax\gethint.php on line 50 Call Stack # Time Memory Function Location 1 0.0002 385600 {main}( ) ...\gethint.php:0 2 0.0002 386544 stristr ( ) ...\gethint.php:50 ajax and php.php gethint.php Link to comment Share on other sites More sharing options...
dsonesuk Posted October 2, 2019 Share Posted October 2, 2019 You have to provide the string to search through (haystack) AND the string to search for (needle), its telling you you only have the first. So you are looking through the haystack not knowing what the needle looks like. Link to comment Share on other sites More sharing options...
Chuks Posted October 2, 2019 Author Share Posted October 2, 2019 Thanks, but I don't know how to provide it. I am only working with the w3schools.com tutorial on PHP - Ajax and PHP. If you. You would notice the file "gethint.php" is as in the tutorial. Link to comment Share on other sites More sharing options...
dsonesuk Posted October 2, 2019 Share Posted October 2, 2019 I can't access it, so if you provide relevant code we might be able to help. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 2, 2019 Share Posted October 2, 2019 The manual shows how to use the function: https://www.php.net/manual/en/function.stristr.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now