Kann mir bitte jemand helfen?
ich komme nicht dahinter warum es mir immer den gleichen Datensatz anzeigt wenn ich auf der Masterseite auf EDIT klicke. Der Upload und das löschen der Einträge funktioniert prima, nur eben das ändern der Daten streikt. Komisch ist wenn ich SELECT * FROM (tabelle) WHERE id='$id' eingebe, dann zeigt es mir keine Daten mehr an aus der DB.
Ich wäre echt froh wenn mir jemand helfn könnte.
PS: ich habe nicht gross Ahnung mit PHP.
Vielen Dank im Voraus...
Miki75
Edit Seite
ich komme nicht dahinter warum es mir immer den gleichen Datensatz anzeigt wenn ich auf der Masterseite auf EDIT klicke. Der Upload und das löschen der Einträge funktioniert prima, nur eben das ändern der Daten streikt. Komisch ist wenn ich SELECT * FROM (tabelle) WHERE id='$id' eingebe, dann zeigt es mir keine Daten mehr an aus der DB.
Ich wäre echt froh wenn mir jemand helfn könnte.
PS: ich habe nicht gross Ahnung mit PHP.
Vielen Dank im Voraus...
Miki75
PHP:
<?php require_once('../../Connections/FKS.php'); ?><?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** 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 == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../error_login.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($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
$maxRows_fks = 10;
$pageNum_fks = 0;
if (isset($_GET['pageNum_fks'])) {
$pageNum_fks = $_GET['pageNum_fks'];
}
$startRow_fks = $pageNum_fks * $maxRows_fks;
mysql_select_db($database_FKS, $FKS);
$query_fks = "SELECT * FROM rl WHERE '$id'='$id' ORDER BY rl.p desc";
$query_limit_fks = sprintf("%s LIMIT %d, %d", $query_fks, $startRow_fks, $maxRows_fks);
$fks = mysql_query($query_limit_fks, $FKS) or die(mysql_error());
$row_fks = mysql_fetch_assoc($fks);
if (isset($_GET['totalRows_fks'])) {
$totalRows_fks = $_GET['totalRows_fks'];
} else {
$all_fks = mysql_query($query_fks);
$totalRows_fks = mysql_num_rows($all_fks);
}
$totalPages_fks = ceil($totalRows_fks/$maxRows_fks)-1;
?>
<?php do { ?><td> </td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
<tr>
<td><?php echo $row_fks['k']; ?></td>
<td><div align="center"><?php echo $row_fks['s']; ?></div></td>
<td><div align="center"><?php echo $row_fks['g']; ?></div></td>
<td><div align="center"><?php echo $row_fks['u']; ?></div></td>
<td><div align="center"><?php echo $row_fks['v']; ?></div></td>
<td><div align="center"><?php echo $row_fks['t']; ?></div></td>
<td bgcolor="#000066"><div align="center"><?php echo $row_fks['p']; ?></div></td>
<td><div align="center"><a href="delete_tabelle.php?id=<?php echo $row_fks['id']; ?>">De</a>-<a href="edit_tabelle.php?id=<?php echo $row_fks['id']; ?>">Ed</a> </div></td>
<?php } while ($row_fks = mysql_fetch_assoc($fks)); ?></tr>
</table>
</div>
</body>
</html>
<?php
mysql_free_result($fks);
?>
Edit Seite
PHP:
<?php require_once('../../Connections/FKS.php'); ?><?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** 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 == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../error_login.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($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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"] == "form1")) {
$updateSQL = sprintf("UPDATE rl SET k=%s, s=%s, g=%s, u=%s, v=%s, t=%s, p=%s WHERE id=%s",
GetSQLValueString($_POST['k'], "text"),
GetSQLValueString($_POST['s'], "text"),
GetSQLValueString($_POST['g'], "text"),
GetSQLValueString($_POST['u'], "text"),
GetSQLValueString($_POST['v'], "text"),
GetSQLValueString($_POST['t'], "text"),
GetSQLValueString($_POST['p'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_FKS, $FKS);
$Result1 = mysql_query($updateSQL, $FKS) or die(mysql_error());
$updateGoTo = "master_tabelle.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_FKS, $FKS);
$query_fks = "SELECT * FROM rl WHERE '$id'='$id'";
$fks = mysql_query($query_fks, $FKS) or die(mysql_error());
$row_fks = mysql_fetch_assoc($fks);
$totalRows_fks = mysql_num_rows($fks);
?>
<div id="main">
<form method="POST" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Id:</td>
<td><?php echo $row_fks['id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">K:</td>
<td><input type="text" name="k" value="<?php echo $row_fks['k']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">S:</td>
<td><input type="text" name="s" value="<?php echo $row_fks['s']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">G:</td>
<td><input type="text" name="g" value="<?php echo $row_fks['g']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">U:</td>
<td><input type="text" name="u" value="<?php echo $row_fks['u']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">V:</td>
<td><input type="text" name="v" value="<?php echo $row_fks['v']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">T:</td>
<td><input type="text" name="t" value="<?php echo $row_fks['t']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">P:</td>
<td><input type="text" name="p" value="<?php echo $row_fks['p']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Datensatz aktualisieren"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id" value="<?php echo $row_fks['id']; ?>">
</form>
<p> </p>
</div>
<div id="Layer1"></div>
<div id="Layer2"></div>
</body>
</html>
<?php
mysql_free_result($fks);
?>