Jump to content

Using php/mysql to do this


mike_tw

Recommended Posts

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 ;D

Link to comment
https://forums.phpfreaks.com/topic/45168-using-phpmysql-to-do-this/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.