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. Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 What? Quote Link to comment 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. Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
sungpeng Posted April 22, 2009 Author Share Posted April 22, 2009 Thank Quote Link to comment 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)); Quote Link to comment 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.