Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- $db_host="localhost";
- $db_user="root";
- $db_password="";
- $db_name="versandhandel";
- $db=new PDO("mysql:host=$db_host; dbname=$db_name; charset=utf8", $db_user, "");
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title> </title>
- </head>
- <body>
- <h3>tartikel</h3>
- <p>Geben Sie bitte Preislimit ein:</p>
- <form method="POST" action="">
- <input type="text" name="preis" /><br />
- <input type="submit" name="send" value="Absenden" /><br />
- </form>
- <?PHP
- if(isset($_POST['send'])){
- if(!$_POST['preis']==""){
- $sql="SELECT * FROM tartikel WHERE Listenpreis <= :preisid";
- }
- else{
- $sql="SELECT * FROM tartikel";
- }
- $stmt=$db -> prepare($sql);
- $stmt -> bindParam(':preisid',$_POST['preis'],PDO::PARAM_INT);
- $stmt -> execute ();
- $anzahl=$stmt -> rowCount();
- if($anzahl>0){
- ?>
- <table border="3">
- <tr>
- <td>ArtikelID</td>
- <td>ArtikelgruppenNr</td>
- <td>Bezeichnung</td>
- <td>Listenpreis</td>
- <td>MW_FS</td>
- <td>Bestand</td>
- <td>Mindestbestand</td>
- <td>Lagerplatz</td>
- </tr>
- <?PHP
- echo "Für ihr Preislimit von ". $_POST['preis'] ."€ wurden folgende Artikel gefunden:";
- while($row = $stmt -> fetch(PDO::FETCH_ASSOC)) {
- echo " <tr> ";
- echo " <td> " .$row['AR_ID'] ." </td> ";
- echo " <td> " .$row['AG_FS'] ." </td> ";
- echo " <td> " .$row['Bezeichnung'] . " </td> ";
- echo " <td> " .$row['Listenpreis'] . " </td> ";
- echo " <td> " .$row['MW_FS'] ."</td> ";
- echo " <td> " .$row['Bestand'] ."</td> ";
- echo " <td> " .$row['Mindestbestand'] ." </td> ";
- echo " <td> " .$row['Lagerplatz'] ." </td> ";
- echo " </tr> ";
- }
- }
- elseif($anzahl<1){
- echo "<br />Es wurden keine entsprechenden Datensätze gefunden";
- }
- }
- ?>
- </table>
- </body>
- </html>
- }
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement