mike_tw Posted April 1, 2007 Share Posted April 1, 2007 http://www.jewson.co.uk/en/templates/bricklibrary/main.jsp?_requestid=1837060 I would like to be able to do something like the above website. Sort a database by using drop downs and then returning the results in table format with pictures. I believe the site there uses java servlets, can i do this with php+mysql. Can anyone point me to a tutorial or give me a brief explanation of how to do this Thanks Quote Link to comment https://forums.phpfreaks.com/topic/45168-using-phpmysql-to-do-this/ Share on other sites More sharing options...
Daniel0 Posted April 1, 2007 Share Posted April 1, 2007 Isn't it just a lot of drop downs? Just search if there are any things in the database that match the things the user chose. Quote Link to comment https://forums.phpfreaks.com/topic/45168-using-phpmysql-to-do-this/#findComment-219265 Share on other sites More sharing options...
mike_tw Posted April 1, 2007 Author Share Posted April 1, 2007 all the drop downs are linked.... If they choose the manufacturer X and the colour Red, then all the red bricks from manufaturer X will display Quote Link to comment https://forums.phpfreaks.com/topic/45168-using-phpmysql-to-do-this/#findComment-219273 Share on other sites More sharing options...
mike_tw Posted April 1, 2007 Author Share Posted April 1, 2007 Isn't it just a lot of drop downs? Just search if there are any things in the database that match the things the user chose. Can i see an example of this, Like a line of code linking the search to the value of the drop down. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/45168-using-phpmysql-to-do-this/#findComment-219292 Share on other sites More sharing options...
mike_tw Posted April 1, 2007 Author Share Posted April 1, 2007 Okay, i made a quick form just to test: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <form method="POST" action="mydomain/results.php" target="_blank"> <p><select size="1" name="Select Manufacturer"> <option value="Manufacturer1">Manufacturer1</option> <option value="Manufacturer2">Manufacturer2</option> <option value="Manufacturer3">Manufacturer3</option> <option selected value="SelectManufacturer">SelectManufacturer</option> </select></p> <p><select size="1" name="Brown"> <option selected value="Select Colour">Select Colour</option> <option>Red</option> <option>Blue</option> <option>Brown</option> </select></p> <p><select size="1" name="rough"> <option selected>Select Texture</option> <option>smooth</option> <option>rough</option> </select></p> <p><input type="submit" value="Submit" name="B1"></p> </form> <p> </p> </body> </html> And heres my test results.php that bring up a table. I've remobed the top half containing my database connection details MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable"); @mysql_select_db( "$dbName") or die( "Unable to select database"); ?> <? $XX = "No Record Found, to search again please close this window"; $query = mysql_query("SELECT * FROM details WHERE $metode LIKE '%$search%' LIMIT 0, 50"); while ($row = @mysql_fetch_array($query)) { $variable1=$row["Manufacturer"]; $variable2=$row["Colour"]; $variable3=$row["Texture"]; print ("<tr>"); print ("<td>$variable1</td>"); print ("<td>$variable2</td>"); print ("<td>$variable3</td>"); print ("</tr>"); } if (!$variable1) { print ("$XX"); } ?> </table> </center> I've made a database with the fields in it.. now i just need to get the results.php to work properly becasue it doesnt at the moment Any help please:D Quote Link to comment https://forums.phpfreaks.com/topic/45168-using-phpmysql-to-do-this/#findComment-219414 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.