Ask a Question related to Dreamweaver AppDev, Design and Development.
-
The_FedEx_Guy #1
Update not working :(
Hi,
I cant seem to find the problem, I hav an update for which displays items to
choose from and then a form at the bottom to enter the model id when update is
clicked the data should be updated for that record but its not updating
The information is not changed.
Help!!!!!!!!!!! :'(
<?php require_once('Connections/connect.php'); ?>
<?
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 = "index.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"] == "form2")) {
$updateSQL = sprintf("UPDATE menu SET Name=%s, Description=%s, Catergory=%s,
Price=%s, `View`=%s WHERE MID=%s",
GetSQLValueString($_POST['Name'], "text"),
GetSQLValueString($_POST['Description'], "text"),
GetSQLValueString($_POST['Catergory'], "text"),
GetSQLValueString($_POST['Price'], "text"),
GetSQLValueString($_POST['View'], "text"),
GetSQLValueString($_POST['MID'], "int"));
mysql_select_db($database_connect, $connect);
$Result1 = mysql_query($updateSQL, $connect) or die(mysql_error());
$updateGoTo = "cpanel.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_connect, $connect);
$query_Recordset1 = "SELECT * FROM menu ORDER BY MID ASC";
$Recordset1 = mysql_query($query_Recordset1, $connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Modify Item</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 16px;
}
-->
</style>
</head>
<body>
<table width="691" border="0" align="center">
<tr>
<td width="685" valign="top" bgcolor="#0099CC"><table width="200"
border="0" align="center">
<tr>
<td><div align="center" class="style1">Modify Item </div></td>
</tr>
</table>
<table width="656" border="0" align="center">
<tr>
<td width="628"> </td>
</tr>
<tr>
<td><table width="652" border="0" align="center">
<?php do { ?>
<tr>
<td width="72" bgcolor="#00CCFF">ID:</td>
<td width="158" valign="top" bgcolor="#00CCFF"><?php echo
$row_Recordset1['MID']; ?></td>
<td width="59" valign="top" bgcolor="#00CCFF">Name:</td>
<td width="313" valign="top" bgcolor="#00CCFF"><?php echo
$row_Recordset1['Name']; ?></td>
</tr>
<tr>
<td> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td height="51" bgcolor="#00CCFF">Description:</td>
<td valign="top" bgcolor="#00CCFF"><?php echo
$row_Recordset1['Description']; ?></td>
<td valign="top" bgcolor="#00CCFF">Category:</td>
<td valign="top" bgcolor="#00CCFF"><?php echo
$row_Recordset1['Catergory']; ?></td>
</tr>
<tr>
<td> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td bgcolor="#00CCFF">Price:</td>
<td valign="top" bgcolor="#00CCFF"><?php echo
$row_Recordset1['Price']; ?></td>
<td valign="top" bgcolor="#00CCFF">View:</td>
<td valign="top" bgcolor="#00CCFF"><?php echo
$row_Recordset1['View']; ?></td>
</tr>
<tr>
<td> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
?>
</table></td>
</tr>
</table>
<table width="394" border="0" align="center">
<tr>
<td width="388"> </td>
</tr>
<tr>
<td><div align="center">
<form method="POST" name="form2" action="<?php echo
$editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">MID:</td>
<td><input type="text" name="MID" value="<?php echo
$row_Recordset1['MID']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Name:</td>
<td><input type="text" name="Name" value="<?php echo
$row_Recordset1['Name']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Description:</td>
<td><textarea name="Description" cols="50" rows="5"><?php
echo $row_Recordset1['Description']; ?></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Catergory:</td>
<td><select name="Catergory">
<option value="Starters" <?php if (!(strcmp("Starters",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>Starters</option>
<option value="Chicken" <?php if (!(strcmp("Chicken",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>Chicken</option>
<option value="Lamb" <?php if (!(strcmp("Lamb",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>Lamb</option>
<option value="Sea Food" <?php if (!(strcmp("Sea Food",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>Sea Food</option>
<option value="Vegetable" <?php if
(!(strcmp("Vegetable", $row_Recordset1['Catergory']))) {echo "SELECTED";}
?>>Vegetable</option>
<option value="Biryani" <?php if (!(strcmp("Biryani",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>Biryani</option>
<option value="Sundries" <?php if (!(strcmp("Sundries",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>Sundries</option>
<option value="European" <?php if (!(strcmp("European",
$row_Recordset1['Catergory']))) {echo "SELECTED";} ?>>European</option>
</select>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Price:</td>
<td><input type="text" name="Price" value="<?php echo
$row_Recordset1['Price']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">View:</td>
<td><select name="View">
<option value="YES" <?php if (!(strcmp("YES",
$row_Recordset1['View
The_FedEx_Guy Guest
-
CFHTTP not working after 7.0.1 Update
Our current config: Win2K, CFMX7 Standard and have applied the 7.0.1 update. It appears the CFHTTP tag is hanging and we are receiving a HTTP 500 -... -
Verity Update Not Working
I'm running ColdFusion 5 on a Dual PIII 533 MhZ system with over a gig of RAM and Apache. A little out-dated, but its handled all our needs well... -
PHP Update query not working
Hello, I'm using a standard update query and getting an error message. Here is the code: if ((isset($HTTP_POST_VARS)) && ($HTTP_POST_VARS ==... -
Template update not working...
Hi! I've been maintaining my site using a previous version of Dreamweaver on an old PC. I've now installed MX on a new PC, and have downloaded the... -
Update to SQL Server is NOT Working
I am using the following code in response to a button press. SqlConnection sqlConn; SqlCommand sqlCmd; sqlUpdate = "update ACCGreatest set...



Reply With Quote

