hansman Posted July 16, 2008 Share Posted July 16, 2008 Hello, i have a sign up form where i have a field named Counties. I wish to be able to enter data such as "Orange, Southern" and have that stored in the mysql database. However, when i store this, one one of my pages i display Counties. I want Orange and Southern to be two different options. How can i go upon changing the way i enter the data into the database or showing the data? Link to comment https://forums.phpfreaks.com/topic/115085-inserting-a-displaying-data/ Share on other sites More sharing options...
marklarah Posted July 16, 2008 Share Posted July 16, 2008 Honestly, I just spent the last 10 minutes trying to understand that, but failed. Please explain a little bit clearer. Also, if you want something, code it. As much as we try, we don't just give you scripts. Try coding your own, then we will help you. As far as I can tell, I can't see your problem. Its displaying the counties. If it isn't, then there is something wrong. Fix it. If you can't, post the code, and we will be happy to help you. Link to comment https://forums.phpfreaks.com/topic/115085-inserting-a-displaying-data/#findComment-591916 Share on other sites More sharing options...
hansman Posted July 16, 2008 Author Share Posted July 16, 2008 ok, so i have my form County: <input name="county" type="text" /> on the next page it is inserted into the database. On the display results page i grab the data $query = "SELECT DISTINCT county FROM ad WHERE state='$state' ORDER BY county ASC"; and i will use this to generate a link to a specific county. echo "<h2><a href=\"profile.php?id=".$row['county']."\" />".$row['county']." County</a> <br> \n</h2> "; So you have the code. When I initially type "Orange" into the county name in the form to be stored it works fine. But i would like to figure out how if i put something like "Orange, Bergen" into the county form, mysql can separate those two inputs. Link to comment https://forums.phpfreaks.com/topic/115085-inserting-a-displaying-data/#findComment-591976 Share on other sites More sharing options...
hansman Posted July 17, 2008 Author Share Posted July 17, 2008 is there a certain function in mysql that will split the data or something? Link to comment https://forums.phpfreaks.com/topic/115085-inserting-a-displaying-data/#findComment-592429 Share on other sites More sharing options...
unkwntech Posted July 17, 2008 Share Posted July 17, 2008 It would be a php function there are several: http://php.net/explode http://php.net/split http://www.php.net/manual/en/function.preg-split.php Link to comment https://forums.phpfreaks.com/topic/115085-inserting-a-displaying-data/#findComment-592430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.