ChaosKnight Posted May 11, 2010 Share Posted May 11, 2010 Hi, I have to make a database for a car rental company and their car groups work with letters of the alphabet, what I wanted to do was to create one table for the country in which the available car groups are listed as something like: ABCDEFGJKMNP, but I want to display information about the different car groups, so I thought it would work if I created another table where each row represents a car group. But then I realized the only way to make such a query would be to turn the string into an array and to query data based on each individual letter as elements of the array... How can I convert a string such as: ABCDEFGJKMNP into an array? Or does anyone perhaps have a better solution? Thanks Link to comment https://forums.phpfreaks.com/topic/201386-help-with-looping-through-a-string/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 11, 2010 Share Posted May 11, 2010 http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html#function_in Link to comment https://forums.phpfreaks.com/topic/201386-help-with-looping-through-a-string/#findComment-1056611 Share on other sites More sharing options...
teamatomic Posted May 11, 2010 Share Posted May 11, 2010 $array = str_split($str); HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/201386-help-with-looping-through-a-string/#findComment-1056615 Share on other sites More sharing options...
ChaosKnight Posted May 11, 2010 Author Share Posted May 11, 2010 Thanks for the posts, that was exactly what I wanted! Thanks once again Link to comment https://forums.phpfreaks.com/topic/201386-help-with-looping-through-a-string/#findComment-1056617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.