Ask a Question related to Dreamweaver AppDev, Design and Development.
-
The_FedEx_Guy #1
UPDATE RECORD DOES NOT WORK
Hey all,
I have a problem using the Update Record Server behaviour. I have a form that
displays the data for a cafe's menu and then allows you to enter data you want
to update.
When I am ready to test it on my local machine, I get this:
Warning: main(@@ConnectionPath@@): failed to open stream: No such file or
directory in C:\sokkit\site\modifyitem.php on line 1
Fatal error: main(): Failed opening required '@@ConnectionPath@@'
(include_path='.;c:/sokkit/php/pear;c:/sokkit/site') in
C:\sokkit\site\modifyitem.php on line 1
I Cant seem to find anything on the net to help me with this error code. :(
I hope someone can help, or find an easier way to update a record.
Thnx in Advance
<?php require_once('@@ConnectionPath@@'); ?>
<?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));
}
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>
<optio
The_FedEx_Guy Guest
-
Update Record
I am trying to update a series of records. The application is an update sequence for the hours of operations for a business. It consists of three... -
Update MS Access record doesn't work right
I use the DW server behavior "Update Record" to update my MS Access record. The Server behavior not only update the very record, it also replace its... -
using dropdown box to display db record & update record
Hi Folks, I have a web database written in asp and using access97. I have many projects, but each project is being held responsible by a person.... -
Update existing From record with changes on new To record
I need to create a history record and update a current record from one input form. The two tables are joined with a query and the table names and... -
Update Record and Submit Form don't work together???
This is a re-statement of a question I posted just a while ago in the Dreamweaver Application Discussion group. I have done some experimenting... -
greekchild #2
Re: UPDATE RECORD DOES NOT WORK
Hi,
I don't know what the very first line is doing but you need to delete it.
<?php require_once('@@ConnectionPath@@'); ?>
greekchild Guest
-
The_FedEx_Guy #3
Re: UPDATE RECORD DOES NOT WORK
hi i've tried doing that has no effect :S
Is there a better way I can update a record?
The_FedEx_Guy Guest
-
The_FedEx_Guy #4
Re: UPDATE RECORD DOES NOT WORK
ok have deleted line, I guess it didnt refresh :(
I have updated an item but the item is still listed with its old data (I have tried refreshing :D )
The_FedEx_Guy Guest



Reply With Quote

