sungpeng Posted April 22, 2009 Share Posted April 22, 2009 echo "$row[price]"; result "category A apple" Hi check can display only "apple" and hide the category A wordings. Link to comment https://forums.phpfreaks.com/topic/155216-solved-hide-wordings-for-php-fetch-mysql-result/ Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 What? Link to comment https://forums.phpfreaks.com/topic/155216-solved-hide-wordings-for-php-fetch-mysql-result/#findComment-816561 Share on other sites More sharing options...
sungpeng Posted April 22, 2009 Author Share Posted April 22, 2009 in mysql "where id=1", "field name fruit" it contain "category A apple" if i echo "$row[fruit]"; out, the result will be "category A apple" I am asking whether there is a function to only display the last character and ignore the first two. I remember macro excel can do it. Link to comment https://forums.phpfreaks.com/topic/155216-solved-hide-wordings-for-php-fetch-mysql-result/#findComment-816569 Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 The last character? You mean like this? $str = $row['price']; $length = strlen($str); echo substr($str, $length - 1, $length); Link to comment https://forums.phpfreaks.com/topic/155216-solved-hide-wordings-for-php-fetch-mysql-result/#findComment-816572 Share on other sites More sharing options...
sungpeng Posted April 22, 2009 Author Share Posted April 22, 2009 Thank Link to comment https://forums.phpfreaks.com/topic/155216-solved-hide-wordings-for-php-fetch-mysql-result/#findComment-816584 Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 No problem. Or did you mean the last word? If so, you can do this: $str = $row['price']; echo end(explode(' ', $str)); Link to comment https://forums.phpfreaks.com/topic/155216-solved-hide-wordings-for-php-fetch-mysql-result/#findComment-816615 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.