RobLamb Posted February 14, 2011 Share Posted February 14, 2011 Hi I have a recordset from a database which outputs a value of '% THOBEKA MFEKA::12110235675?' I need to seach the database based on the number between the :: and ? only. So for example '12110235675'. I have tried this with a sql statement using LIKE but its not working. How can I trim the value from the database so I only get the number out. The amount of characters before the :: can vary. Please can someone give me some advice asap. Rob Quote Link to comment Share on other sites More sharing options...
litebearer Posted February 14, 2011 Share Posted February 14, 2011 Please show your code, especially where you have tried LIKE Quote Link to comment Share on other sites More sharing options...
RobLamb Posted February 14, 2011 Author Share Posted February 14, 2011 sorry, here we go.... SELECT SUM(points_allocated) AS total FROM tbl_points WHERE member_id = %s Cant be more simple than that surely! Quote Link to comment Share on other sites More sharing options...
litebearer Posted February 14, 2011 Share Posted February 14, 2011 Untested, un-proof-read, un-not-done-with-first-coffee... $search_term = ":12110235675?"; $query = "SELECT SUM(points_allocated) AS total FROM tbl_points WHERE member_id = LIKE '%$search_term'"; 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.