houssam_ballout Posted February 8, 2012 Share Posted February 8, 2012 Hello, I need help with the following: I had a dynamic variable in this form: XXXX-Y-A-B (which is called ID) XXXX is always fixed (character) Y is also a single character A is an integer B is an integer I am quering a database that had list of that IDs , and I need to know the value of A each time (A could be 1, 2, 3, 11, 200....) Any help? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/256655-help-locating-a-string/ Share on other sites More sharing options...
spiderwell Posted February 8, 2012 Share Posted February 8, 2012 you will probably need some sort of regular expression but I am not sure if those can be used in mysql? This post might be in the wrong section because of this .. sorry I couldn't contribute more Quote Link to comment https://forums.phpfreaks.com/topic/256655-help-locating-a-string/#findComment-1315694 Share on other sites More sharing options...
houssam_ballout Posted February 8, 2012 Author Share Posted February 8, 2012 Well, after I get variable from mysql , they are stored in php variable within a loop. Any help is much appreciated. best Quote Link to comment https://forums.phpfreaks.com/topic/256655-help-locating-a-string/#findComment-1315697 Share on other sites More sharing options...
spiderwell Posted February 8, 2012 Share Posted February 8, 2012 ok, I think i mis understood this, so perhaps use explode like this: $arr = explode("-","XXXX-Y-A-B"); echo $arr[2]; Quote Link to comment https://forums.phpfreaks.com/topic/256655-help-locating-a-string/#findComment-1315700 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.