Hallo,
Ich möschte in einer PHP/HTML Tabele, die meiner Datenbank was raus nimmt und anzeigt, mit "INPUT" denn Eintrag Löschen aber zuvor diese ausgabe in eine andere Tabele übertragen.
Das heist:
Das ganze ist eine Wunschbox die der moderator wenn er den Wunsch gespielt hat löschen soll, aber der lösch Button nicht wirglich löscht sindern Arschieviert.
Mein Code
Es würde schön sein wenn mir dor einer weiter helfen kann.
MFG
PaSe
Ich möschte in einer PHP/HTML Tabele, die meiner Datenbank was raus nimmt und anzeigt, mit "INPUT" denn Eintrag Löschen aber zuvor diese ausgabe in eine andere Tabele übertragen.
Das heist:
- Datenbank auslessen (angezeigt via NICHT editierbares Formular)
- Eintrag in andere Tabele in der Datenbank übergeben ber INPUT Button
- und gleichzeitig das was übertragen worden ist Löschen
Das ganze ist eine Wunschbox die der moderator wenn er den Wunsch gespielt hat löschen soll, aber der lösch Button nicht wirglich löscht sindern Arschieviert.
Mein Code
Code:
<?php require_once('../Connections/db.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = "Admin,Mod"; $MM_donotCheckaccess = "false"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && false) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "../fehler/admin.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $MM_referrer .= "?" . $_SERVER['QUERY_STRING']; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) { $updateSQL = sprintf("UPDATE wunsch WHERE Status1=%s", GetSQLValueString($_POST['Status1'], "int")); mysql_select_db($database_db, $db); $Result1 = mysql_query($updateSQL, $db) or die(mysql_error()); $updateGoTo = "status.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE wunsch SET Status1=%s WHERE ID=%s", GetSQLValueString($_POST['Status1'], "text"), GetSQLValueString($_POST['ID'], "int")); mysql_select_db($database_db, $db); $Result1 = mysql_query($updateSQL, $db) or die(mysql_error()); $updateGoTo = "status.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- mysql_select_db($database_db, $db); $query_Recordset1 = "SELECT * FROM wunsch WHERE Status1 = Status1"; $Recordset1 = mysql_query($query_Recordset1, $db) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_select_db($database_db, $db); $query_Recordset1 = "SELECT * FROM wunsch ORDER BY Datum ASC"; $Recordset1 = mysql_query($query_Recordset1, $db) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="refresh" content="10"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="../css/style.css" rel="stylesheet" type="text/css" /> <title>Adminbereich Wunsch Status</title> <script type="text/javascript"> function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } </script> </head> <body> <?php do { ?> <center><hr color="#ff7100" id="line" width="470" align="center" /></center> <table border="0" align="center"> <tr> <td align="right">Wunsch ID:</td> <td align="left"><a class="bid"><?php echo $row_Recordset1['ID']; ?></a></td> </tr> <tr> <td align="right"> </td> <td align="left"> </td> </tr> <tr> <td align="right">Datum:</td> <td align="left"><a class="wdatum"><?php echo $row_Recordset1['Datum']; ?></a></td> </tr> <tr> <td align="right">Name:</td> <td align="left"><a class="wstatus"><?php echo $row_Recordset1['Name']; ?></a></td> </tr> <tr> <td align="right" valign="top">Grüße:</td> <td align="left" width="370"><a class="wstatus"><?php echo $row_Recordset1['Grusse']; ?></a></td> </tr> <tr> <td align="right"> </td> <td align="left"> </td> </tr> <tr> <td align="right">Interpret:</td> <td align="left"><a class="wstatus"><?php echo $row_Recordset1['Interpret']; ?></a></td> </tr> <tr> <td align="right">Titel:</td> <td align="left"><a class="wstatus"><?php echo $row_Recordset1['Titel']; ?></a></td> </tr> <tr> <td align="right">IP:</td> <td align="left"><a class="bip"><?php echo $row_Recordset1['IP']; ?></a></td> </tr> <tr> <td colspan="2" align="center"><center><hr color="#ff7100" id="line" width="470" align="center" /></center></td> </tr> <tr> <td colspan="2" align="right"> <table border="0" align="center" width="100%"> <td align="center"> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table border="0" align="center" width="100%"> <tr> <td nowrap="nowrap" align="left" width="50">Status setzen:</td> <td align="left" width="140"><input type="radio" name="Status1" value="WARTET" size="1" />in bearbeitung</td> <td rowspan="2" align="left" width="50"><input type="submit" value="Ändern" /></td> <td rowspan="2" align="right" class="<?php echo $row_Recordset1['Status1']; ?>"><?php echo $row_Recordset1['Status1']; ?></td> <td rowspan="2"> </td> </tr> <tr> <td> </td> <td align="left"><input type="radio" name="Status1" value="SPIELT" size="1" />Wird gespielt</td> </tr> </table> <input type="hidden" name="MM_update" value="form1" /> <input type="hidden" name="ID" value="<?php echo $row_Recordset1['ID']; ?>" /> </form> </td> <td align="right"><img height="32" width="32" src="../bilder/<?php echo $row_Recordset1['Status1']; ?>.png" /></td> </table> </td> </tr> <tr> <td colspan="2" align="center"><center><hr color="#ff7100" id="line" width="470" align="center" /></center></td> </tr> <tr> <td colspan="2" align="center"><form id="form2" name="form2" method="post" action="w_weg.php"> <input name="IDL" type="hidden" id="IDL" value="<?php echo $row_Recordset1['ID']; ?>" /> <input type="submit" name="button4" id="button4" value="Löschen" /> </form></td> </tr> </table> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </body> </html> <?php mysql_free_result($Recordset1); ?>
MFG
PaSe
Kommentar