Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "
- <h2>Keresés</h2>
- <form name='search' method='post'>
- Keresés erre: <input type='text' name='find' />
- <Select NAME='field'>
- <Option VALUE='nev'>Neve</option>
- <Option VALUE='foosztaly'>Főosztálya</option>
- <Option VALUE='szine'>Színe</option>
- </Select>
- <input type='hidden' name='searching' value='yes' />
- <input type='submit' name='search' value='Keres' />
- </form>";
- if ($searching=='yes') { echo '<h2>Találatok:</h2>'; }
- if ($find = "") { echo "<h3>nincs kulcsszó/h3>"; }
- $db = mysql_connect ("localhost","wordpress","BqTtCRGSrEryQtht");
- $mydb = mysql_select_db("wordpress_adatok");
- $find=$_POST['find'];
- $field =$_POST['field'];
- //ha ide a field helyére azt írom hogy nev, foosztaly vagy szine akkor ok, de a //váltózval nem működik
- $sql="SELECT nev,foosztaly,szine FROM gems WHERE '$field' LIKE '$find'";
- $result=mysql_query($sql);
- while($row=mysql_fetch_array($result))
- {
- echo "Név: " . $row['nev'] . " class: " . $row['foosztaly'] . " szine: ". $row['szine'];
- echo "<br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment