Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <?php
- $q=$_GET["keyword"];
- $host = "localhost";
- $user = "X31251643";
- $password = "X31251643";
- $con = mysql_pconnect($host, $user, $password);
- if (!$con) {
- die('Could not connect to database: ');
- }
- $dbname = "X31251643";
- mysql_select_db($dbname);
- $query="SELECT * FROM Products
- WHERE ItemID = '$q'
- OR ItemType = '$q'
- OR ItemName = '$q'";
- $result = mysql_query($query);
- echo "<table border='1'>
- <tr>
- <th>itemID</th>
- <th>ItemType</th>
- <th>ItemName</th>
- <th>ItemDescription</th>
- <th>ItemPrice</th>
- </tr>";
- while ($row = mysql_fetch_array($result)) {
- foreach($row as $data) {
- echo "<tr>";
- echo "<td> ".$data['ItemID']." </td>";
- echo "<td> ".$data['ItemType']." </td>";
- echo "<td> ".$data['ItemName']." </td>";
- echo "<td> ".$data['ItemDescription']." </td>";
- echo "<td> ".$data['ItemPrice']." </td>";
- echo "</tr>";
- }
- }
- echo "</table>";
- mysql_close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement