I am accessing a mysql database and displaying a column. in this column is a long string lets say its this:
<image identifier="540aa2ad-9a8d-454d-b915-605b884e76d5">
<file><![CDATA[images/MV5BMTg5OTMxNzk4Nl5BMl5BanBnXkFtZTcwOTk1MjAwNQ@@._V1._SY317_CR0,0,214,317_.jpg]]></file>
<title/>
<link/>
whatever lies between <![CDATA[images/ and .jpg]]></file> will change on every row and i want to echo whatever lies between them pieces of code.
anyone help?
thanks
edit
so far i have:
function inStr ($needle, $haystack)
{
$needlechars = strlen($needle); //gets the number of characters in our needle
$i = 0;
for($i=0; $i < strlen($haystack); $i++) //creates a loop for the number of characters in our haystack
{
if(substr($haystack, $i, $needlechars) == $needle) //checks to see if the needle is in this segment of the haystack
{
return TRUE; //if it is return true
}
}
return FALSE; //if not, return false
}
$img = '
SELECT *
FROM `item`
';
$result0 = mysql_query($img);
while ($row0 = mysql_fetch_array($result0)){
$haystack = $row0['elements'];
$needle = '<![CDATA[images/';
}
if(inStr($needle, $haystack))
{
echo "string is present";
}