Witam
Mam problem w edycji tabeli na mojej stronie kiedy dodaje wiersze w kolumnach na dole,wiersze dodają się również na górze i odwrotnie.
Post już znajdował sie na forum jednak nie otrzymałem pomocy.
<?php session_start();
### POŁĄCZENIE Z BAZĄ DANYCH ###
$host = ""; // Hosting bazy danych
$user = ""; // Użytkownik bazy danych
$pass = ""; // Hasło bazy danych
$db = ""; // Używana baza danych
$table = ""; // Używana tabela bazy danych
$error = "..."; // Informacja o błędnym połączeniu z bazą danych
### KONFIGURACJA SERWISU ###
$title = "Tytuł"; // Nazwa strony w nagłówku
$background = "http://i63.tinypic.com/23kf5gj.jpg"; // Obraz tła na stronie
$admin_login = "admin"; // Login do konta administratora
$admin_pass = "admin"; // Hasło do konta administratora
$info_guest = "Pełny dostęp wymaga uprzedniego zalogowania się do panelu."; // Informacja o wymaganym zalogowaniu do panelu
$alert_login = "Wpisano nieprawidłowy login lub hasło."; // Komunikat o niepomyślnym logowaniu
$alert_access = "Brak dostępu do wykonania tej czynności."; // Komunikat o nieupoważnionej interakcji
$alert_limit = "Osiągnięto limit dostępnych komórek w tabeli."; // Komunikat o przekroczonym limicie komórek
$alert_block = "Zablokowano usunięcie tej komórki w tabeli."; // Komunikat o przekroczonym limicie komórek
$alert_space = "Brak wystarczającej ilości wolnych miejsc."; // Komunikat o braku wystarczającej przestrzeni
$button_login = "Zaloguj"; // Nazwa przycisku logowania
$button_logout = "Wyloguj"; // Nazwa przycisku wylogowania
$button_add = "Dodaj"; // Nazwa przycisku dodawania zamówienia
$button_clear = "Wyczyść"; // Nazwa przycisku czyszczącego komórkę
$button_create = "Utwórz"; // Nazwa przycisku tworzącego komórkę
$td_width = "250px"; // Domyślna szerokość komórki w tabelach
$td_color = Array(
0 => "FFFFFF",
// Kolor pustej komórki w tabelach
1 => Array("zaległy towar", "FF0000"),
2 => Array("wysyłka", "FFFF00"),
3 => Array("Nowa wysyłka", "00FF00"),
// Kolory zajętych komórek w tabelach
);
$td_name = Array(
0 => "lp.",
// Nazwa identyfikatora komórek w tabelach
1 => "T1",
2 => "T2",
3 => "T3",
4 => "T4",
5 => "T5",
// Nazwy kolumn nadrzędnych w tabeli pierwszej
6 => "T6",
7 => "T7",
8 => "T8",
9 => "T9",
10 => "T10",
// Nazwy kolumn nadrzędnych w tabeli drugiej
);
$td_limit = 21; // Limit wszystkich komórek w tabeli razem z dodatkowymi
$td_block = 6; // Ilość zablokowanych komórek z niemożliwością usunięcia
?>
<?php
mysql_connect($host, $user, $pass) or die($error);
mysql_select_db($db) or die($error);
mysql_query("SET CHARACTER SET UTF8");
$account_login = mysql_real_escape_string($_POST['account_login']);
$account_password = mysql_real_escape_string($_POST['account_password']);
$add_name = mysql_real_escape_string($_POST['add_name']);
$add_info = mysql_real_escape_string($_POST['add_info']);
$add_count = mysql_real_escape_string($_POST['add_count']);
$add_color = mysql_real_escape_string($_POST['add_color']);
$delete_id = mysql_real_escape_string($_GET['delete']);
$t1 = mysql_real_escape_string($_GET['t1']);
$t2 = mysql_real_escape_string($_GET['t2']);
$t3 = mysql_real_escape_string($_GET['t3']);
$t4 = mysql_real_escape_string($_GET['t4']);
$t5 = mysql_real_escape_string($_GET['t5']);
$t6 = mysql_real_escape_string($_GET['t6']);
$t7 = mysql_real_escape_string($_GET['t7']);
$t8 = mysql_real_escape_string($_GET['t8']);
$t9 = mysql_real_escape_string($_GET['t9']);
$t10 = mysql_real_escape_string($_GET['t10']);
$rows = mysql_query("SELECT * FROM `".$table."` LIMIT ".$td_limit.";");
if(!empty($account_login) && !empty($account_password)) {
if($admin_login == $account_login && $admin_pass == $account_password) {
$_SESSION['cookies_ok'] = TRUE;
$_SESSION['account_login'] = $account_login;
} else {
echo '<script type="text/javascript">alert("'.$alert_login.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
}
if(isset($_GET['add']) && !empty($add_name) && !empty($add_info) && !empty($add_count) && !empty($add_color) && $_SESSION['cookies_ok'] == TRUE) {
$add_rows = mysql_query("SELECT * FROM `".$table."` WHERE `T".$add_name."_INFO` = '';");
if($add_count <= mysql_num_rows($add_rows)) {
$add_select = mysql_query("SELECT * FROM `".$table."` WHERE `T".$add_name."_INFO` = '' LIMIT ".$add_count.";");
while($add_update = mysql_fetch_array($add_select)){
mysql_query("UPDATE `".$table."` SET `T".$add_name."_INFO` = '".$add_info."', `T".$add_name."_COLOR` = '".$add_color."' WHERE `ID` = '".$add_update['ID']."';");
}
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
} else {
echo '<script type="text/javascript">alert("'.$alert_space.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
}
if(isset($_GET['more'])) {
if($_SESSION['cookies_ok'] == TRUE) {
$add_more = mysql_num_rows(mysql_query("SELECT * FROM `".$table."`;"));
if($add_more < $td_limit) {
mysql_query("INSERT INTO `".$table."` (`ID`, `T1_INFO`, `T2_INFO`, `T3_INFO`, `T4_INFO`, `T5_INFO`, `T6_INFO`, `T7_INFO`, `T8_INFO`, `T9_INFO`, `T10_INFO`, `T1_COLOR`, `T2_COLOR`, `T3_COLOR`, `T4_COLOR`, `T5_COLOR`, `T6_COLOR`, `T7_COLOR`, `T8_COLOR`, `T9_COLOR`, `T10_COLOR`) VALUES (NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');");
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
} else {
echo '<script type="text/javascript">alert("'.$alert_limit.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
} else {
echo '<script type="text/javascript">alert("'.$alert_access.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
}
if(isset($_GET['delete'])) {
if($_SESSION['cookies_ok'] == TRUE) {
if($_GET['delete'] > $td_block) {
mysql_query("DELETE FROM `".$table."` WHERE `ID` = '".$delete_id."';");
mysql_query("ALTER TABLE `".$table."` AUTO_INCREMENT = 1;");
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
} else {
echo '<script type="text/javascript">alert("'.$alert_block.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
} else {
echo '<script type="text/javascript">alert("'.$alert_access.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
}
if(isset($_GET['color'])) {
if($_SESSION['cookies_ok'] == TRUE) {
if(isset($_GET['t1'])) {
mysql_query("UPDATE `".$table."` SET `T1_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t1."';");
} elseif(isset($_GET['t2'])) {
mysql_query("UPDATE `".$table."` SET `T2_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t2."';");
} elseif(isset($_GET['t3'])) {
mysql_query("UPDATE `".$table."` SET `T3_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t3."';");
} elseif(isset($_GET['t4'])) {
mysql_query("UPDATE `".$table."` SET `T4_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t4."';");
} elseif(isset($_GET['t5'])) {
mysql_query("UPDATE `".$table."` SET `T5_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t5."';");
} elseif(isset($_GET['t6'])) {
mysql_query("UPDATE `".$table."` SET `T6_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t6."';");
} elseif(isset($_GET['t7'])) {
mysql_query("UPDATE `".$table."` SET `T7_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t7."';");
} elseif(isset($_GET['t8'])) {
mysql_query("UPDATE `".$table."` SET `T8_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t8."';");
} elseif(isset($_GET['t9'])) {
mysql_query("UPDATE `".$table."` SET `T9_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t9."';");
} elseif(isset($_GET['t10'])) {
mysql_query("UPDATE `".$table."` SET `T10_COLOR` = '".$_GET['color']."' WHERE `ID` = '".$t10."';");
}
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
} else {
echo '<script type="text/javascript">alert("'.$alert_access.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
}
if(isset($_GET['clear'])) {
if($_SESSION['cookies_ok'] == TRUE) {
if(isset($_GET['t1'])) {
mysql_query("UPDATE `".$table."` SET `T1_INFO` = '', `T1_COLOR` = '' WHERE `ID` = '".$t1."';");
} elseif(isset($_GET['t2'])) {
mysql_query("UPDATE `".$table."` SET `T2_INFO` = '', `T2_COLOR` = '' WHERE `ID` = '".$t2."';");
} elseif(isset($_GET['t3'])) {
mysql_query("UPDATE `".$table."` SET `T3_INFO` = '', `T3_COLOR` = '' WHERE `ID` = '".$t3."';");
} elseif(isset($_GET['t4'])) {
mysql_query("UPDATE `".$table."` SET `T4_INFO` = '', `T4_COLOR` = '' WHERE `ID` = '".$t4."';");
} elseif(isset($_GET['t5'])) {
mysql_query("UPDATE `".$table."` SET `T5_INFO` = '', `T5_COLOR` = '' WHERE `ID` = '".$t5."';");
} elseif(isset($_GET['t6'])) {
mysql_query("UPDATE `".$table."` SET `T6_INFO` = '', `T6_COLOR` = '' WHERE `ID` = '".$t6."';");
} elseif(isset($_GET['t7'])) {
mysql_query("UPDATE `".$table."` SET `T7_INFO` = '', `T7_COLOR` = '' WHERE `ID` = '".$t7."';");
} elseif(isset($_GET['t8'])) {
mysql_query("UPDATE `".$table."` SET `T8_INFO` = '', `T8_COLOR` = '' WHERE `ID` = '".$t8."';");
} elseif(isset($_GET['t9'])) {
mysql_query("UPDATE `".$table."` SET `T9_INFO` = '', `T9_COLOR` = '' WHERE `ID` = '".$t9."';");
} elseif(isset($_GET['t10'])) {
mysql_query("UPDATE `".$table."` SET `T10_INFO` = '', `T10_COLOR` = '' WHERE `ID` = '".$t10."';");
}
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
} else {
echo '<script type="text/javascript">alert("'.$alert_access.'");</script>';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
}
if(isset($_GET['logout']) && $_SESSION['cookies_ok'] == TRUE) {
$_SESSION['cookies_ok'] = FALSE;
$_SESSION['account_login'] = '';
echo '<meta http-equiv="refresh" content="0; URL=index.php">';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
background: url(<?php echo $background; ?>);
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
}
a {
text-decoration: none;
}
#table td {
font-family: Verdana, Arial, sans-serif;
border: 1px solid black;
padding: 5px;
}
.popup {
position: relative;
display: inline-block;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.popup .popuptext {
visibility: hidden;
width: 160px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 8px 0;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -80px;
}
/* Popup arrow */
.popup .popuptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
/* Toggle this class - hide and show the popup */
.popup .show {
visibility: visible;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
}
/* Add animation (fade in the popup) */
@-webkit-keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}
@keyframes fadeIn {
from {opacity: 0;}
to {opacity:1 ;}
}
</style>
<script type="text/javascript">
<?php
$select_popupT1 = 1;
while($select_popupT1 <= $td_limit) {
?>
function T1myFunction<?php echo $select_popupT1; ?>() {
var popup = document.getElementById("T1myPopup<?php echo $select_popupT1; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT1++;
}
?>
<?php
$select_popupT2 = 1;
while($select_popupT2 <= $td_limit) {
?>
function T2myFunction<?php echo $select_popupT2; ?>() {
var popup = document.getElementById("T2myPopup<?php echo $select_popupT2; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT2++;
}
?>
<?php
$select_popupT3 = 1;
while($select_popupT3 <= $td_limit) {
?>
function T3myFunction<?php echo $select_popupT3; ?>() {
var popup = document.getElementById("T3myPopup<?php echo $select_popupT3; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT3++;
}
?>
<?php
$select_popupT4 = 1;
while($select_popupT4 <= $td_limit) {
?>
function T4myFunction<?php echo $select_popupT4; ?>() {
var popup = document.getElementById("T4myPopup<?php echo $select_popupT4; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT4++;
}
?>
<?php
$select_popupT5 = 1;
while($select_popupT5 <= $td_limit) {
?>
function T5myFunction<?php echo $select_popupT5; ?>() {
var popup = document.getElementById("T5myPopup<?php echo $select_popupT5; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT5++;
}
?>
<?php
$select_popupT6 = 1;
while($select_popupT6 <= $td_limit) {
?>
function T6myFunction<?php echo $select_popupT6; ?>() {
var popup = document.getElementById("T6myPopup<?php echo $select_popupT6; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT6++;
}
?>
<?php
$select_popupT7 = 1;
while($select_popupT7 <= $td_limit) {
?>
function T7myFunction<?php echo $select_popupT7; ?>() {
var popup = document.getElementById("T7myPopup<?php echo $select_popupT7; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT7++;
}
?>
<?php
$select_popupT8 = 1;
while($select_popupT8 <= $td_limit) {
?>
function T8myFunction<?php echo $select_popupT8; ?>() {
var popup = document.getElementById("T8myPopup<?php echo $select_popupT8; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT8++;
}
?>
<?php
$select_popupT9 = 1;
while($select_popupT9 <= $td_limit) {
?>
function T9myFunction<?php echo $select_popupT9; ?>() {
var popup = document.getElementById("T9myPopup<?php echo $select_popupT9; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT9++;
}
?>
<?php
$select_popupT10 = 1;
while($select_popupT10 <= $td_limit) {
?>
function T10myFunction<?php echo $select_popupT10; ?>() {
var popup = document.getElementById("T10myPopup<?php echo $select_popupT10; ?>");
popup.classList.toggle("show");
}
<?php
$select_popupT10++;
}
?>
</script>
<title><?php echo $title; ?></title>
</head>
<body>
<center>
<fieldset style="width:450px;height:70px;background-color:#CCCCCC;">
<?php
if($_SESSION['cookies_ok'] == FALSE) {
echo '<form method="post"><input type="text" id="input" name="account_login" placeholder="Login" required="required"> <input type="password" id="input" name="account_password" placeholder="Hasło" required="required"> <input type="submit" id="submit" value="'.$button_login.'"></form>';
} elseif($_SESSION['cookies_ok'] == TRUE) {
echo '<form action="?logout" method="post"><input type="text" id="input" value="Witaj, '.$_SESSION['account_login'].'!" disabled="disabled"> <input type="submit" id="submit" value="'.$button_logout.'"></form>';
}
echo '<hr>';
if($_SESSION['cookies_ok'] == FALSE) {
echo '<b>'.$info_guest.'</b>';
} elseif($_SESSION['cookies_ok'] == TRUE) {
echo '<form action="?add" method="post">';
$select_name = 1;
echo '<select name="add_name">';
while($select_name <= count($td_name)-1) {
echo '<option value="'.$select_name.'">'.$td_name[$select_name].'</option>';
$select_name++;
}
echo '</select>';
echo ' ';
echo '<input type="text" id="input" name="add_info" placeholder="Nazwa" required="required">';
echo ' ';
$select_count = 1;
echo '<select name="add_count">';
if(mysql_num_rows($rows) == 0) {
echo '<option>0</option>';
}
while($select_count <= mysql_num_rows($rows)) {
echo '<option value="'.$select_count.'">'.$select_count.'</option>';
$select_count++;
}
echo '</select>';
echo ' ';
$select_color = 1;
echo '<select name="add_color">';
while($select_color <= count($td_color)-1) {
echo '<option style="background-color:#'.$td_color[$select_color][1].'" value="'.$td_color[$select_color][1].'">'.$td_color[$select_color][0].'</option>';
$select_color++;
}
echo '</select>';
echo ' ';
echo '<input type="submit" id="submit" value="'.$button_add.'">';
echo '</form>';
}
?>
</fieldset>
<br>
<table id="table">
<?php
$rows = mysql_query("SELECT * FROM `".$table."` LIMIT ".$td_limit.";");
if(mysql_num_rows($rows) >= 1) {
echo '<tr>';
echo '<td align="center" style="background:#CCCCCC"><b>'.$td_name[0].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[1].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[2].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[3].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[4].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[5].'</b></td>';
echo '</tr>';
while($array = mysql_fetch_array($rows)) {
$lp_a = $lp_a+1;
echo '<tr>';
echo '<td align="center" width="30px" style="background:#CCCCCC"><b>'.$lp_a.'.</b></td>';
if($array['T1_INFO'] == "" && $array['T1_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T1_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T1_COLOR'].'">';
echo '<div class="popup" onclick="T1myFunction'.$lp_a.'()"><font color="#000000">'.$array['T1_INFO'].'</font>';
echo '<span class="popuptext" id="T1myPopup'.$lp_a.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t1='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t1='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T2_INFO'] == "" && $array['T2_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T2_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T2_COLOR'].'">';
echo '<div class="popup" onclick="T2myFunction'.$lp_a.'()"><font color="#000000">'.$array['T2_INFO'].'</font>';
echo '<span class="popuptext" id="T2myPopup'.$lp_a.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t2='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t2='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T3_INFO'] == "" && $array['T3_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T3_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T3_COLOR'].'">';
echo '<div class="popup" onclick="T3myFunction'.$lp_a.'()"><font color="#000000">'.$array['T3_INFO'].'</font>';
echo '<span class="popuptext" id="T3myPopup'.$lp_a.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t3='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t3='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T4_INFO'] == "" && $array['T4_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T4_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T4_COLOR'].'">';
echo '<div class="popup" onclick="T4myFunction'.$lp_a.'()"><font color="#000000">'.$array['T4_INFO'].'</font>';
echo '<span class="popuptext" id="T4myPopup'.$lp_a.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t4='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t4='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T5_INFO'] == "" && $array['T5_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T5_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T5_COLOR'].'">';
echo '<div class="popup" onclick="T5myFunction'.$lp_a.'()"><font color="#000000">'.$array['T5_INFO'].'</font>';
echo '<span class="popuptext" id="T5myPopup'.$lp_a.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t5='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t5='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($lp_a > $td_block) {
echo '<td align="center" width="30px" style="background:#CCCCCC"><b><a href="?delete='.$array['ID'].'"><font color="#000000">[<font color="#CC0000">-</font>]</font></a></b></td>';
}
echo '</tr>';
}
echo '<tr><th></th><th></th><th></th><th></th><th></th><th></th><td align="center" width="30px" style="background:#CCCCCC"><b><a href="?more"><font color="#000000">[<font color="#00CC00">+</font>]</font></a></b></td></tr>';
}
?>
</table>
<br>
<table id="table">
<?php
$rows = mysql_query("SELECT * FROM `".$table."` LIMIT ".$td_limit.";");
if(mysql_num_rows($rows) >= 1) {
echo '<tr>';
echo '<td align="center" style="background:#CCCCCC"><b>'.$td_name[0].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[6].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[7].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[8].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[9].'</b></td><td align="center" style="background:#CCCCCC"><b>'.$td_name[10].'</b></td>';
echo '</tr>';
while($array = mysql_fetch_array($rows)) {
$lp_b = $lp_b+1;
echo '<tr>';
echo '<td align="center" width="30px" style="background:#CCCCCC"><b>'.$lp_b.'.</b></td>';
if($array['T6_INFO'] == "" && $array['T6_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T6_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T6_COLOR'].'">';
echo '<div class="popup" onclick="T6myFunction'.$lp_b.'()"><font color="#000000">'.$array['T6_INFO'].'</font>';
echo '<span class="popuptext" id="T6myPopup'.$lp_b.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t6='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t6='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T7_INFO'] == "" && $array['T7_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T7_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T7_COLOR'].'">';
echo '<div class="popup" onclick="T7myFunction'.$lp_b.'()"><font color="#000000">'.$array['T7_INFO'].'</font>';
echo '<span class="popuptext" id="T7myPopup'.$lp_b.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t7='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t7='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T8_INFO'] == "" && $array['T8_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T8_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T8_COLOR'].'">';
echo '<div class="popup" onclick="T8myFunction'.$lp_b.'()"><font color="#000000">'.$array['T8_INFO'].'</font>';
echo '<span class="popuptext" id="T8myPopup'.$lp_b.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t8='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t8='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T9_INFO'] == "" && $array['T9_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T9_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T9_COLOR'].'">';
echo '<div class="popup" onclick="T9myFunction'.$lp_b.'()"><font color="#000000">'.$array['T9_INFO'].'</font>';
echo '<span class="popuptext" id="T9myPopup'.$lp_b.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t9='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t9='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($array['T10_INFO'] == "" && $array['T10_COLOR'] == "") {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$td_color[0].'">'.$array['T10_INFO'].'</td>';
} else {
echo '<td align="center" width="'.$td_width.'" style="background:#'.$array['T10_COLOR'].'">';
echo '<div class="popup" onclick="T10myFunction'.$lp_b.'()"><font color="#000000">'.$array['T10_INFO'].'</font>';
echo '<span class="popuptext" id="T10myPopup'.$lp_b.'">';
$select_color = 1;
while($select_color <= count($td_color)-1) {
echo '<a href="?color='.$td_color[$select_color][1].'&t10='.$array['ID'].'"><button style="width:125px;background-color:#'.$td_color[$select_color][1].';">'.$td_color[$select_color][0].'</button></a>';
$select_color++;
}
echo '<hr>';
echo '<a href="?clear&t10='.$array['ID'].'"><button style="width:125px">'.$button_clear.'</button></a>';
echo '</span></div></td>';
}
if($lp_b > $td_block) {
echo '<td align="center" width="30px" style="background:#CCCCCC"><b><a href="?delete='.$array['ID'].'"><font color="#000000">[<font color="#CC0000">-</font>]</font></a></b></td>';
}
echo '</tr>';
}
echo '<tr><th></th><th></th><th></th><th></th><th></th><th></th><td align="center" width="30px" style="background:#CCCCCC"><b><a href="?more"><font color="#000000">[<font color="#00CC00">+</font>]</font></a></b></td></tr>';
}
?>
</table>
<?php
$rows = mysql_query("SELECT * FROM `".$table."` LIMIT ".$td_limit.";");
if(mysql_num_rows($rows) == 0) {
echo '<a href="?more"><button>'.$button_create.'</button></a>';
}
?>
<br>
</center>
</body>
</html>
SQL
-- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Czas generowania: 10 Paź 2017, 16:55
-- Wersja serwera: 10.1.24-MariaDB-cll-lve
-- Wersja PHP: 5.6.27
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `Towary`
--
CREATE TABLE `Towary` (
`ID` int(11) NOT NULL,
`T1_INFO` varchar(255) NOT NULL,
`T2_INFO` varchar(255) NOT NULL,
`T3_INFO` varchar(255) NOT NULL,
`T4_INFO` varchar(255) NOT NULL,
`T5_INFO` varchar(255) NOT NULL,
`T6_INFO` varchar(255) NOT NULL,
`T7_INFO` varchar(255) NOT NULL,
`T8_INFO` varchar(255) NOT NULL,
`T9_INFO` varchar(255) NOT NULL,
`T10_INFO` varchar(255) NOT NULL,
`T1_COLOR` varchar(255) NOT NULL,
`T2_COLOR` varchar(255) NOT NULL,
`T3_COLOR` varchar(255) NOT NULL,
`T4_COLOR` varchar(255) NOT NULL,
`T5_COLOR` varchar(255) NOT NULL,
`T6_COLOR` varchar(255) NOT NULL,
`T7_COLOR` varchar(255) NOT NULL,
`T8_COLOR` varchar(255) NOT NULL,
`T9_COLOR` varchar(255) NOT NULL,
`T10_COLOR` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Zrzut danych tabeli `Towary`
--
INSERT INTO `Towary` (`ID`, `T1_INFO`, `T2_INFO`, `T3_INFO`, `T4_INFO`, `T5_INFO`, `T6_INFO`, `T7_INFO`, `T8_INFO`, `T9_INFO`, `T10_INFO`, `T1_COLOR`, `T2_COLOR`, `T3_COLOR`, `T4_COLOR`, `T5_COLOR`, `T6_COLOR`, `T7_COLOR`, `T8_COLOR`, `T9_COLOR`, `T10_COLOR`) VALUES
(1, 'x', '', '', '', '', '', '', '', '', '', 'FF0000', '', '', '', '', '', '', '', '', ''),
(2, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(3, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(4, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(5, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(6, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(7, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(8, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(9, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(10, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(11, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(12, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(13, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(14, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(15, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
--
-- Indeksy dla zrzutów tabel
--
--
-- Indexes for table `Towary`
--
ALTER TABLE `Towary`
ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT dla tabeli `Towary`
--
ALTER TABLE `Towary`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Manuel.Artificer