willingtolearn Posted March 7, 2012 Share Posted March 7, 2012 Hi, I'll be honest don't have a clue what I am doing but a friend asked me to look into her site, she gets the following error at the top of this page http://www.morairaluxuryvillas.com/rentals/villalist.php Warning: strpos() [function.strpos]: Offset not contained in string in /home/morairal/public_html/rentals/villalist.php on line 85 the code on the line 85 is: $secondfstemp = strpos($block1, ".", $firstfs); I am more than willing to look into but don't know where to start - anyone have any ideas? Thanks for your time:-) Quote Link to comment https://forums.phpfreaks.com/topic/258450-warning-strpos-functionstrpos-offset-not-contained-in-string/ Share on other sites More sharing options...
requinix Posted March 7, 2012 Share Posted March 7, 2012 The message means that $firstfs (where strpos() is to begin looking for a period) is negative* or beyond the end of the string**. We need to see more code. Especially the stuff that creates $firstfs and what's in between that code and the line you posted. My guess is that $block1 is has one period at the very end and that the $firstfs code looks like $firstfs = strpos($block1, ".") + 1; While we're at it, how about some context? What does the code do? What is $block1? * Maybe. Might have different message for that case. ** Technically, greater than or equal to. Quote Link to comment https://forums.phpfreaks.com/topic/258450-warning-strpos-functionstrpos-offset-not-contained-in-string/#findComment-1324799 Share on other sites More sharing options...
willingtolearn Posted March 7, 2012 Author Share Posted March 7, 2012 Hi thanks for the reply - i have attached the code, you were right with your guess, I am trying to figure out what $block1 is... It is a property site and she inserts the property details in through her admin section, this page lists all of the properties and pulls a brief description of every property listed down the page.. Thanks again for your help:-) 17728_.php Quote Link to comment https://forums.phpfreaks.com/topic/258450-warning-strpos-functionstrpos-offset-not-contained-in-string/#findComment-1324803 Share on other sites More sharing options...
willingtolearn Posted March 7, 2012 Author Share Posted March 7, 2012 Hi - thanks for your help, but it is fixed now, I think it was because she hadn't filled in all the property details for the top property and fields were left blank, once I deleted it, the error disappeared. Quote Link to comment https://forums.phpfreaks.com/topic/258450-warning-strpos-functionstrpos-offset-not-contained-in-string/#findComment-1324853 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.