Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Cod Er
Courses Plus Student 86 PointsConnect php-database to a drop down button
Hello!
Im trying to build a drop down button that will have countrys to chose from.
What Im trying to do is to connect my countrys in my php database to my drop down button.
I have created 2 columns in the database. 1 is ID and 2 is Item.
In the Item column, I have created 3 countries.
What I want is to connect those 3 countries to the drop down buttoon so you can chose any of those three.
My tablet in the databse is called: countrys.
This is my code for connecting to the databse:
function query () { $myData = mysql_query("SELECT * FROM countrys"); while($record = mysql_fetch_array($myData)){ echo '<option value=\"'. $record['item']. '\">' . $record['item'].'</option>';
Because its now working, there's got to be something wrong. If anyone know, then please feel free to answer!
Thanks :)
1 Answer
Cod Er
Courses Plus Student 86 Pointsbump