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 Link to comment https://forums.phpfreaks.com/topic/227613-trimming-a-recordset/ 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 Link to comment https://forums.phpfreaks.com/topic/227613-trimming-a-recordset/#findComment-1173995 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! Link to comment https://forums.phpfreaks.com/topic/227613-trimming-a-recordset/#findComment-1173996 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'"; Link to comment https://forums.phpfreaks.com/topic/227613-trimming-a-recordset/#findComment-1174000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.