Jump to content

kaf

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kaf's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <html> <head> <title> Movies Search </title> <style type="text/css"> table{ background-color: #FCF; } th { width: 150px; text-align: left; } </style> </head> <body> <h1> Movie Search </h1> <form method="post" action="search1.php"> <input type="hidden" name="submitted" value="true" /> <label> Search Category: <select name="category"> <option value="title">Title</option> <option value="genre">Genre</option> <option value="director">Director</option> </select> </label> <label> Search Criteria: <input type="text" name="criteria" /></label> <input type="submit" /> </form> } <?php if (isset($_POST['submitted'])) { //connect to the database include 'connect.php' $category = $_POST['category']; $criteria = $_POST['criteria']; $query = "SELECT * FROM 'movies' WHERE '"$category"' LIKE '"$criteria"'"; $result = mysqli_query($query, $dbcon) or die ('error getting data');} echo "<table>"; echo "<tr> <th>movie_id</th> <th>title</th> <th>genre</th> <th>director</th> </tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ echo "<tr><td>"; echo $row['movie_id']; echo "<td><td>"; echo "<tr><td>"; echo $row['title']; echo "<td><td>"; echo "<tr><td>"; echo $row['genre']; echo "<td><td>"; echo "<tr><td>"; echo $row['director']; echo "<td><tr>"; } echo "</table>"; } ?> // end of main if statement </body> </html> thanks
  2. thanks that worked got rid of most the code and the table which isn't meant to show up till after the retrieval of the data thanks this is what it looks like now i think i have to change these echo tags somewhere hmmm
  3. I'm using xampp so phpmyadmin and localhost/ to try out the code...
  4. hey everyone I'm really new to php so basically this text keeps coming up here are my two codes 'connect.php' and search1.php I got my codes from this guy on youtube http://www.youtube.com/user/rrphillips#p/search/5/IYmS5HRo6JI seems to be working for everyone else... Would really appreciate your help Thanks guys
×
×
  • 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.