ltrem Posted June 25, 2009 Share Posted June 25, 2009 Hey guys, I have a cell that is filled with alot of text. At some point in the text, there is a line break in the MYSQL CELL that I just can't find after I retreive the value in my php code.... heres a little sample of the value in the cell. habitable et de coûts de construction.<br /><br /> Vous avez trouvé la maison There is absolutely nothing between the > and the Vous... Thanks alot ! PS. I tried if(strpos($searchDesc, '\n' )){ // I tried '\r\n' too... echo 'yes, its found'; }else{ echo 'not found'; } while $searchDesc is the concerned cell Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/ Share on other sites More sharing options...
mikesta707 Posted June 25, 2009 Share Posted June 25, 2009 try searching for the newline character \n or the carriage return character \r Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863652 Share on other sites More sharing options...
ltrem Posted June 25, 2009 Author Share Posted June 25, 2009 tried \n, \r, \r\n.... nothing Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863659 Share on other sites More sharing options...
phant0m Posted June 25, 2009 Share Posted June 25, 2009 use double quotes when searching for \n, \r or anything the like Do you use nl2br and htmlentities or htmlspecialchars somewhere? because it looks like you first you nl2br and then escape the html Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863663 Share on other sites More sharing options...
ltrem Posted June 25, 2009 Author Share Posted June 25, 2009 Do you use nl2br and htmlentities or htmlspecialchars somewhere? because it looks like you first you nl2br and then escape the html First of all, I retrieve a cell from the DB that is XML content, from that XML, I retrieve the value I need. Then I do a html_entity_decode() AND strip_tags() to finally insert it in another MYSQL Table. Now is the problem, when I retrieve that same value I just inserted, I can't separate the Line Break... Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863671 Share on other sites More sharing options...
mikesta707 Posted June 25, 2009 Share Posted June 25, 2009 try searching for <br /> Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863677 Share on other sites More sharing options...
ltrem Posted June 25, 2009 Author Share Posted June 25, 2009 When I saw your answer I was like... oh god... Why didn't me or anyone saw that... then I tried it.... and then it failed again! Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863692 Share on other sites More sharing options...
ltrem Posted June 25, 2009 Author Share Posted June 25, 2009 I even try that search directly after getting it out of the XML........ and it can't find those thing even if its clearly there in my Database... Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863699 Share on other sites More sharing options...
mikesta707 Posted June 25, 2009 Share Posted June 25, 2009 post the code you are using to search for it. If its there like you say its there, a simple search function should fine it. Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863705 Share on other sites More sharing options...
ltrem Posted June 25, 2009 Author Share Posted June 25, 2009 Bit of code to get the XML $searchDesc = $xml_arrVal['searchtext']; //retrieve the XML value I need if(strpos($searchDesc, "<br />" )){ echo 'yes, its found'; }else{ echo 'not found'; } and the $xml_arrVal['searchtext']; = <field index="searchtext"> <value index="vDEF">blablabla ....À vous d'y attribuer le rôle désiré !<br /><br /> Vous avez trouvé la maison de style...blablabla</value> </field> And maybe you might want this.. the head of the XML <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?> <T3FlexForms> <data> <sheet index="sDEF"> <language index="lDEF"> Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863709 Share on other sites More sharing options...
mikesta707 Posted June 25, 2009 Share Posted June 25, 2009 well firstly, strpos doesn't return a boolean value unless its false, it returns an integer value, so that might be what is causing problems. try something like if (strpos($searchDesc, "stuff") === false){ echo "Fail"; } else { echo "Success!"; } Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863713 Share on other sites More sharing options...
ltrem Posted June 25, 2009 Author Share Posted June 25, 2009 still fail.... :S Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863729 Share on other sites More sharing options...
mikesta707 Posted June 25, 2009 Share Posted June 25, 2009 if (strpos($searchDesc, "stuff") !== false){ echo "Succes"; } else { echo "Fail"; } I don't know what to tell you, im running out of ideas Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-863733 Share on other sites More sharing options...
ltrem Posted June 26, 2009 Author Share Posted June 26, 2009 The code you just gave me work.. but shouldn't... $pos = strpos($searchDesc, "<br />"); echo 'value : ' . $pos; returns me nothing.. awww Quote Link to comment https://forums.phpfreaks.com/topic/163684-mysql-cell-line-break-how-to-find-them-with-php/#findComment-864038 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.