Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zoek form
- <form method="post" action="search.php">
- <select name="metode" size="1">
- <option value="naam">naam</option>
- <option value="jaar">jaar</option>
- <option value="prijs">prijs</option></select>
- <input type="text" name="search" size="25">
- <input type="submit" value="Zoeken">
- </form>
- //search.php
- <?
- $hostname = "localhost"; // Usually localhost.
- $username = "user"; // If you have no username, leave this space empty.
- $password = "pass"; // The same applies here.
- $dbName = "DBname"; // This is the main database you connect to.
- MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
- @mysql_select_db( "$dbName") or die( "Unable to select database");
- ?>
- <?
- //error message (not found message)
- $XX = "<li>No Record Found</li>";
- //if ($metode = 'kleur.naam'){
- $query = mysql_query("SELECT wijn.id as id, wijn.naam as wijn, wijn.jaar as jaar, wijn.prijs as prijs, kleur.naam as kleur, land.naam as land, streek.naam as streek FROM kleur,wijn,land,streek WHERE $metode LIKE '%$search%' AND kleur.id = wijn.kleur_id AND land.id = wijn.land_id AND land.id = streek.land_id AND streek.id = wijn.streek_id LIMIT 0, 51");
- //}
- //else{
- //$query = mysql_query("SELECT * FROM wijn WHERE $metode LIKE '%$search%' LIMIT 0, 30");
- //}
- //$result = mysql_query($query) or die(mysql_error());
- while ($row = mysql_fetch_array($query))
- {
- $variable=$row["id"];
- $variable1=$row["wijn"];
- $variable2=$row["jaar"];
- $variable3=$row["prijs"];
- print $variable1</span>";
- }
- //below this is the function for no record!!
- if (!$variable1)
- {
- print ("$XX");
- }
- //end
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement