SHOW:
|
|
- or go back to the newest paste.
| 1 | //Delete data with the id from database | |
| 2 | - | $sql = "select * from products |
| 2 | + | if(isset($_POST['products_delete'])){
|
| 3 | - | where |
| 3 | + | $sql = "delete from products |
| 4 | where | |
| 5 | - | "; |
| 5 | + | |
| 6 | "; | |
| 7 | mysqli_query($db,$sql) or die(mysqli_error($db)); | |
| 8 | header('location:'.$_SERVER['PHP_SELF']."?page=".@$_GET['page']);
| |
| 9 | }; | |
| 10 | }; | |
| 11 | ||
| 12 | function product_details($db){
| |
| 13 | ||
| 14 | $sql = "select * from products where id = .@$_GET['id']"; | |
| 15 | ||
| 16 | $sqlQuery = mysqli_query($db,$sql) or die(mysqli_error($db)); | |
| 17 | // header('location:'.$_SERVER['PHP_SELF']."?page=".@$_GET['page']);
| |
| 18 | $intQuery = mysqli_num_rows($sqlQuery); | |
| 19 | if($intQuery == true){
| |
| 20 | while($dbFetch = mysqli_fetch_array($sqlQuery)){
| |
| 21 | if(!isset($dbFetch['img'])){
| |
| 22 | $image = "image/no_image.png"; | |
| 23 | }else{
| |
| 24 | $image = $dbFetch['img']; | |
| 25 | } | |
| 26 | echo ' <div class="grid_10 content"> | |
| 27 | <img class="grid_4 image "><img src="image/'.$image.'"/> | |
| 28 | <p class="name">'.$dbFetch['title'].'</p> | |
| 29 | <p class="text">'.$dbFetch['description'].'</p> | |
| 30 | <p class="fotograf">'.$dbFetch['creator'].'</p> | |
| 31 | <span class="pris">'.number_format($dbFetch['price'], 2, ',', '.').' DKK <a href="'.$_SERVER['PHP_SELF'].'?add_product='.$dbFetch['id'].'"><img src="image/icon/iconset/round_plus_icon&16.png" /></a></span><br /> | |
| 32 | ||
| 33 | </div><a href="index.php"><div class=" grid_1 buy"></div></a>' | |
| 34 | ; | |
| 35 | ||
| 36 | ||
| 37 | } | |
| 38 | } | |
| 39 | } |