UPDATE RECORD DOES NOT WORK

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default 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">&nbsp;</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>&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</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>&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</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>&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</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">&nbsp;</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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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....
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139