php if isset _POST del_ico id real_mysql _POST del_id q_del DELETE FRO

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
if(isset($_POST['del_ico'])){
$id = real_mysql($_POST['del_id']);
$q_del = "DELETE FROM `products` WHERE id=$id";
mysql_query ($q_del)
or die(mysql_error());
}
$q = "SELECT `id`, `mini_img` FROM `products` ORDER BY `id` DESC";
$res = mysql_query($q)
or die(mysql_error());
$c = 0;
while($c < mysql_num_rows($res)){
$inf = mysql_fetch_assoc($res);
$id = $inf['id'];
$img = $inf['mini_img'];
$nom = '';
if($c < 3) $nom = 'nom';
if($auth){
$admin_panel_products = '<div class="mod_panel">
<div onclick="location.href=\''.$site.'/edit/'.$id.'\'" class="resub_ico">Редакт.</div>
<form action="" method=post">
<input name="del_id" type="hidden" value="'.$id.'">
<button type="submit" name="del_ico" class="del_ico">Удалить</button>
</form>
</div>';
}
if($auth){
$admin_add_products = '<div onclick="location.href=\''.$site.'/auth\'" class="radius-3 add_vinil_block">Добавить винил</div>';
}
$tovars .= '<div class="goods_main default_shadow radius-3 '.$nom.'">'.
$admin_panel_products
.'<img onclick="location.href=\''.$site.'/products/'.$id.'\'" src="'.$img.'" alt="" />
<div class="more_inf">
<div onclick="location.href=\''.$site.'/products/'.$id.'\'" class="more_inf_btn first_btn">Заказать</div>
<div class="more_inf_btn" onclick="location.href=\''.$site.'/products/'.$id.'\'">Подробнее</div>
</div>
</div>';
$c++;
}
echo $tovars;
echo $admin_add_products;