36 lines
1.3 KiB
PHP
36 lines
1.3 KiB
PHP
<?php
|
|
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
|
|
|
|
if(isset($_GET['arrPunkt']))
|
|
{
|
|
$sql = 'SELECT id_user FROM `reclame_table` WHERE id_user='.$_GET['idUser']. ' AND id_table='.$_GET['idTable'];
|
|
$reSql = mysql_query($sql);
|
|
$res = mysql_fetch_assoc($reSql);
|
|
$arrPunkt = implode(",", $_GET['arrPunkt']);
|
|
if(!$res) {
|
|
$sqlIntro = "INSERT INTO reclame_table (id_table, id_user, item_list) VALUES (".$_GET['idTable'].",".$_GET['idUser'].", '".$arrPunkt."')";
|
|
mysql_query($sqlIntro);
|
|
} else {
|
|
$sqlUpdate = 'UPDATE reclame_table SET item_list="'.$arrPunkt.'" WHERE id_user='.$_GET['idUser']. ' AND id_table='.$_GET['idTable'];
|
|
mysql_query($sqlUpdate);
|
|
}
|
|
|
|
}
|
|
|
|
if(isset($_POST['arrPunkt']))
|
|
{
|
|
$sql = 'SELECT id_user FROM `reclame_table` WHERE id_user='.$_POST['idUser']. ' AND id_table='.$_POST['idTable'];
|
|
$reSql = mysql_query($sql);
|
|
$res = mysql_fetch_assoc($reSql);
|
|
$arrPunkt = implode(",", $_POST['arrPunkt']);
|
|
if(!$res) {
|
|
$sqlIntro = "INSERT INTO reclame_table (id_table, id_user, item_list) VALUES (".$_POST['idTable'].",".$_POST['idUser'].", '".$arrPunkt."')";
|
|
mysql_query($sqlIntro);
|
|
} else {
|
|
$sqlUpdate = 'UPDATE reclame_table SET item_list="'.$arrPunkt.'" WHERE id_user='.$_POST['idUser']. ' AND id_table='.$_POST['idTable'];
|
|
//echo $sqlUpdate;
|
|
mysql_query($sqlUpdate);
|
|
}
|
|
|
|
}
|