pumaf1 Posted August 29, 2007 Share Posted August 29, 2007 hi, my second question - on my website i am programming a interactive db, please see http://www.pumaf1.org.uk/res/infobase/search.php to see what i mean want i would like to do is the following - grab data to build the "drivers" drop down list from the db - done (as you can see) from that list enable a user to click on the driver name and go to a page for that driver that pulls out all the results for that one driver. thats the problem. for example you click on "raikkonen, kimi", and you get the url http://www.pumaf1.org.uk/res/infobase/Raikkonen,%20Kimi now what i am TRYING to do is have a page that you load the results page http://www.pumaf1.org.uk/res/infobase/search.php select your driver, and it would pull out every race result for that driver. That driver will have more than one result in the db so it needs to be a repeat region I am using dreamweaver mx 2004, and am really stuck. Please be aware I am only learning PHP and MYSQL so please make it easy if you can. you can see what I would expect (albeit for engines output)(there will be more than one drop down list when its finished) www.pumaf1.org.uk/res/infobase/engine-ferrari.php of course anyone that helps me with this will get a mention in the credits section of the site if they so wish thanks in advance Dave Quote Link to comment https://forums.phpfreaks.com/topic/67256-dynamic-list-to-select-certain-data-from-db/ Share on other sites More sharing options...
madspof Posted August 29, 2007 Share Posted August 29, 2007 this is what i made to create a dynamic drop down list from a database all you would have to do is change the mysql query to suit your needs dont know if this heps anyway whilst writing this i can smell burning and about to run for the extinguisher for my computer hope this helps i might not be able to reply <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name=""; // Database name $tbl_name=""; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); echo'<select name="categories">'; $res=mysql_query("select * from $tbl_name"); if(mysql_num_rows($res)==0) echo "there is no data in table.."; else for($i=0;$i<mysql_num_rows($res);$i++) { $row=mysql_fetch_assoc($res); echo"<option>$row[userid]</option>"; } echo'</select>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67256-dynamic-list-to-select-certain-data-from-db/#findComment-337393 Share on other sites More sharing options...
pumaf1 Posted August 30, 2007 Author Share Posted August 30, 2007 Thanks-i have the list made, i need help on how to get it to pull the remaining data from the database Quote Link to comment https://forums.phpfreaks.com/topic/67256-dynamic-list-to-select-certain-data-from-db/#findComment-337802 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.