jkkenzie Posted April 14, 2010 Share Posted April 14, 2010 From the below text, i dont have the digits "13" in the text from the db, i dont know where it comes from: "individual gates and large living areas. 13The spacious lo" this results after php echo on page. Any way to strip or trim ? Thanks Link to comment https://forums.phpfreaks.com/topic/198499-unknown-characters-from-a-text-field/ Share on other sites More sharing options...
conker87 Posted April 14, 2010 Share Posted April 14, 2010 Can we have the code please? Link to comment https://forums.phpfreaks.com/topic/198499-unknown-characters-from-a-text-field/#findComment-1041593 Share on other sites More sharing options...
jkkenzie Posted April 14, 2010 Author Share Posted April 14, 2010 The part that brings code that makes the script not to work is : "<p><?=$shortdesc2?></p> " if(is_array($row_rs_premier)){ foreach ($row_rs_premier as $row_rs_premier){ $shortdesc=""; $sPattern = '/\s*/m'; $sReplace = ''; $shortdesc=substr($row_rs_premier['brief'], 0, 150); $shortdesc2=preg_replace( $sPattern, $sReplace, $shortdesc ); if($int==1){ ?> sts_ai("i0",[1,"<table width=\"300\" height=\"150\" cellpadding=\"0\" cellspacing=\"0\" style=\"font-size:11px; font-family:Verdana; margin:10px;\">\r\n <tr>\r\n <td width=\"91\" rowspan=\"12\" class=\"STYLE10\"><img src=\"show_image.php?filename=modules/classifieds/images/<?=$row_rs_premier["adphotos"]?>&width=100&height=100\" alt=\"\" name=\"p\" width=\"80\" height=\"158\" id=\"p\" /></td>\r\n <td width=\"300\" class=\"STYLE10\"> </td>\r\n </tr>\r\n <tr>\r\n <td> </td>\r\n </tr>\r\n \r\n <tr>\r\n <td><a href=\"<?=BASE_URL?>data/classifieds/classifieds_details/<?=$row_rs_premier["Id"]?>/<?=$row_rs_premier["title"]?>.vrt?id=<?=$row_rs_premier["Id"]?>\" style=\"color:#000000\"><strong style=\"color:#0000FF\"><u><?=$row_rs_premier["title"];?></u></strong></a></td>\r\n </tr>\r\n \r\n <tr>\r\n <td><img src=\"modules/classifieds/images/buy_icon.gif\" width=\"16\" height=\"16\"><a href=\"<?=BASE_URL?>data/classifieds/classifieds_details/<?=$row_rs_premier["Id"]?>/<?=$row_rs_premier["title"]?>.vrt?id=<?=$row_rs_premier["Id"]?>\"><?=$row_rs_premier["price"]?></a> </td>\r\n </tr>\r\n <tr>\r\n <td valign=\"top\"><p><?=$shortdesc2?></p></td>\r\n </tr>\r\n \r\n</table>","","_self","",0,0,"left"],["#FFFFFF","9pt Arial","#000000","none","9pt Arial","#000000","none"]); <?php }else{?> sts_ai("i<?=$int?>",[,"<table width=\"300\" height=\"150\" cellpadding=\"0\" cellspacing=\"0\" style=\"font-size:11px; font-family:Verdana; margin:10px;\">\r\n <tr>\r\n <td width=\"91\" rowspan=\"12\" class=\"STYLE10\"><img src=\"show_image.php?filename=modules/classifieds/images/<?=$row_rs_premier["adphotos"]?>&width=100&height=100\" alt=\"\" name=\"p\" width=\"80\" height=\"158\" id=\"p\" /></td>\r\n <td width=\"300\" class=\"STYLE10\"> </td>\r\n </tr>\r\n <tr>\r\n <td><a href=\"<?=BASE_URL?>data/classifieds/classifieds_details/<?=$row_rs_premier["Id"]?>/<?=$row_rs_premier["title"]?>.vrt?id=<?=$row_rs_premier["Id"]?>\" style=\"color:#000000\"><strong style=\"color:#0000FF\"><u><?=$row_rs_premier["title"];?></u></strong></a></td>\r\n </tr>\r\n \r\n <tr>\r\n <td><img height=\"16\" src=\"modules/classifieds/images/buy_icon.gif\" width=\"16\" /><a href=\"<?=BASE_URL?>data/classifieds/classifieds_details/<?=$row_rs_premier["Id"]?>/<?=$row_rs_premier["title"]?>.vrt?id=<?=$row_rs_premier["Id"]?>\" class=\"STYLE17\"><a style=\"color:#FF0000\"></a></a><a href=\"<?=BASE_URL?>data/classifieds/classifieds_details/<?=$row_rs_premier["Id"]?>/<?=$row_rs_premier["title"]?>.vrt?id=<?=$row_rs_premier["Id"]?>\"><?=$row_rs_premier["price"]?></a></td>\r\n </tr>\r\n <tr>\r\n <td><p><?=$shortdesc2?></p> </td>\r\n </tr>\r\n \r\n</table>"],[],"i0","i0"); <?php } $int++; } } ?> sts_es(); </script> Link to comment https://forums.phpfreaks.com/topic/198499-unknown-characters-from-a-text-field/#findComment-1041596 Share on other sites More sharing options...
jkkenzie Posted April 14, 2010 Author Share Posted April 14, 2010 using preg_replace in the code i provided, makes the script work , BUT all spaces are removed and that means all words join as one word even sentences join Link to comment https://forums.phpfreaks.com/topic/198499-unknown-characters-from-a-text-field/#findComment-1041598 Share on other sites More sharing options...
jkkenzie Posted April 14, 2010 Author Share Posted April 14, 2010 $sPattern = '/\s\s+/'; That made it work . thank you Link to comment https://forums.phpfreaks.com/topic/198499-unknown-characters-from-a-text-field/#findComment-1041624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.