Delete record behaviour (PHP/mySQL)

I've just worked through this whole database thing from
scratch again after a little glitch, and it's all working pretty
well.
I do still have the issue with deleting records - I have the
search results page which is fine, and has a delete options at the
end of the row.
It was working just fine bringing up the 'confirm deletion'
page with the selected record - but it goes wrong after I add the
'delete record' server behaviour.
Basically after I do, when I click delete in the results
page, it skips the 'confirm deletion' page, going straight to the
'deletion confirmed' page. It's as tho' simply going to the
confirmation page is triggering the deletion, rather than requiring
the 'delete record' button to be pressed. Does the form / button
require an 'action'? Although as far as I can tell I followed the
instructions
correctly, but something is going wrong on the confirmation page.
It does still delete the record at least, but it would be
good to have the confirmation page.
Here's a link (if you need to log in use 'admin' and
'password'.)
link
This is all the script code in the 'confirm delete' page :
<?php require_once('../Connections/ConnHandprint.php');
?>
<?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;
if ((isset($_GET['recordID'])) && ($_GET['recordID']
!= "")) {
$deleteSQL = sprintf("DELETE FROM Contacts WHERE
ContactID=%s",
GetSQLValueString($_GET['recordID'], "int"));
mysql_select_db($database_ConnHandprint, $ConnHandprint);
$Result1 = mysql_query($deleteSQL, $ConnHandprint) or
die(mysql_error());
$deleteGoTo = "contactdeleted.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $deleteGoTo));
$colname_Recordset1 = "1";
if (isset($_GET['recordID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ?
$_GET['recordID'] : addslashes($_GET['recordID']);
mysql_select_db($database_ConnHandprint, $ConnHandprint);
$query_Recordset1 = sprintf("SELECT * FROM Contacts WHERE
ContactID = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $ConnHandprint)
or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
Any ideas?
Cheers

Hello,
S. Khawar wrote:
my question is that when I execute DELETE_RECORD built in it fails due to constraint restriction and Oracle forms raise message that "Child record exist/unable to delete record " until here it's Ok but Oracle Forms still removes record from the screen/form and move up the remaining records(although record is failed to delete).Yet this is the default forms behaviour. Because when you press delete it will remove from the screen but not from the database till you use COMMIT as francois mentioned.
I want the Oracle Form to do not remove record from screen/form once it's failed to delete record actually.Yes, for this type of requirement. Why don't you check dependency of record before removing the record. What i mean is you can use the code in KEY-DELREC trigger like below (before using the DELETE_RECORD built-in) for checking if child record exists then show message otherwise remove. For example...
DECLARE
  vCntRec NUMBER;
BEGIN
  SELECT COUNT(*)
  INTO vCntRec
  FROM child_table_name
  WHERE key_column = :form_key_column_name;
  IF vCntRec>0 THEN  -- Here means record found in child table so it will not remove from screen but message will appear.
    MESSAGE('<Your error message goes here...>');
    MESSAGE('<Your error message goes here...>');
    RAISE FORM_TRIGGER_FAILURE;
  ELSE  -- Here mean there is not dependency so it will remove which is default forms behaviour.
    DELETE_RECORD;
  END IF;
END;So, when you will press button for delete first it will check for any child record if exsits then it will display message and will not vanish from the screen otherwise it will remove from the screen and furthor COMMIT will remove from database.
-Ammad
Edited by: Ammad Ahmed on Jul 7, 2010 8:48 AM

Similar Messages

  • Update record problem PHP MYSQL

    hi all,
    I have a problem with DW 8's update server behaviour. I'm not
    sure if its that or a MYSQL problem:
    I have one page: upload2.php and there is an option for the
    user to change their password.
    But when I enter the user details, and the new password, the
    database does not change at all.
    Where am I going wrong?

    The_FedEx_Guy wrote:
    > Which header information is this? I have never come
    across this.
    It's probably the most common beginner's mistake in PHP after
    forgetting
    such things as semicolons or matching quotes:
    "Remember that header() must be called before any actual
    output is sent,
    either by normal HTML tags, blank lines in a file, or from
    PHP. It is a
    very common error to read code with include(), or require(),
    functions,
    or another file access function, and have spaces or empty
    lines that are
    output before header() is called. The same problem exists
    when using a
    single PHP/HTML file."
    http://uk.php.net/manual/en/function.header.php
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Deleting records - mySQL / PHP

    I've just worked through this whole database thing from
    scratch again after a little glitch, and it's all working pretty
    well.
    I do still have the issue with deleting records - I have the
    search results page which is fine, and has a delete options at the
    end of the row.
    It was working just fine bringing up the 'confirm deletion'
    page with the selected record - but it goes wrong after I add the
    'delete record' server behaviour.
    Basically after I do, when I click delete in the results
    page, it skips the 'confirm deletion' page, going straight to the
    'deletion confirmed' page.
    It does still delete the record at least, but it would be
    good to have the confirmation page.
    Here's a
    link
    (if you need to log in use 'admin' and 'password'.)
    This is all the script code in the 'confirm delete' page :
    <?php require_once('../Connections/ConnHandprint.php');
    ?>
    <?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;
    if ((isset($_GET['recordID'])) && ($_GET['recordID']
    != "")) {
    $deleteSQL = sprintf("DELETE FROM Contacts WHERE
    ContactID=%s",
    GetSQLValueString($_GET['recordID'], "int"));
    mysql_select_db($database_ConnHandprint, $ConnHandprint);
    $Result1 = mysql_query($deleteSQL, $ConnHandprint) or
    die(mysql_error());
    $deleteGoTo = "contactdeleted.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
    header(sprintf("Location: %s", $deleteGoTo));
    $colname_Recordset1 = "1";
    if (isset($_GET['recordID'])) {
    $colname_Recordset1 = (get_magic_quotes_gpc()) ?
    $_GET['recordID'] : addslashes($_GET['recordID']);
    mysql_select_db($database_ConnHandprint, $ConnHandprint);
    $query_Recordset1 = sprintf("SELECT * FROM Contacts WHERE
    ContactID = %s", $colname_Recordset1);
    $Recordset1 = mysql_query($query_Recordset1, $ConnHandprint)
    or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    Any ideas?
    Cheers,
    Iain

    Hi,
    It is a good idea to do it in database level such that declare foreign key from child to parent table and specify DELETE CASCADE.
    regards,
    '

  • CS6 Dreamweaver using PHP & MySQL - Delete Record Server Behavior?

    When I try to insert the Delete Record server behavior. I get an error message about a DeleteRecord.js file, which seems to be missing or defective.  I cannot use the server behavior.  I have a file that I developed using CS5, and it does indeed delete the record, but does not proceed to the destination I want.  I cannot change that except in the server behavior, so I'm stuck.  I have noticed that server behaviors seem to disappear without apparent cause, as it seems to have in this case.  I will appreciate any suggestions!  Is there any way to embed a call to a target page manually?  All is working WITHOUT the server behavior appearing, but I want to go to a confirmation display page that shows the record is indeed deleted, and we just return to the (now blank) delete confirmation page.  That'll drive a user bonkers!
    Thanks!
    Delete Record in CS6 Dreamweaver using PHP & MySQL?

    Well, your error message is self-explanatory.
    DW stores ServerBehaviors in 'Configuration' folder in installation directory. If one of the behavior JS files is missing/ corrupt, you'll see the error message you just did.
    I've uploaded a functional, proper version of DeleteRecord.js onto my site for you to download. Here's the link:
    http://www.sudarshan.me/adobeforum/dw/app/behavior-js/DeleteRecord.zip
    Download this file, extract it and put DeleteRecord.js file in your installation directory as follows. If prompted, 'replace' your local copy:
    Mac: Applications > Adobe Dreamweaver CS6 > Configuration > ServerBehaviors > PHP_MySQL
    Windows: C:\Users\Your User Name\AppData\Roaming\Adobe\Dreamweaver CS6\[language]\Configuration\ServerBehaviors\PHP_MySQL
    It should work as expected.
    If that still doesn't solve the problem, reset your DW preferences and cache and try doing it. Follow the instructions here to reset cache: http://forums.adobe.com/thread/494811
    Let us know how it goes.
    -ST

  • PHP Delete Record Issue

    I've set up a simple database for adding event news to a
    site. I'm pretty new to PHP, but I have the Insert, Update, and
    Display pages working properly. However the Delete Record page is
    being a big pain. I have it set up just as it explains in
    Dreamweaver Help, as well as a tutorial i am using as a backbone
    for this project. Its a form with a hidden filed that is
    dynamically pulling my ID. I have the Delete behavior pointing at
    the same ID and record set.
    My Delete link is properly setting up a dynamic page with the
    title of record to be deleted showing up just fine. Also, the
    redirect page is correct after hitting the Delete button. Which
    makes me believe the issue is happening in somewhere in the
    behavior. None of my records are being deleted when I go back to
    the Display page. They are still there. Im pointing the behavior at
    my Primary record so im not sure what's going on. I'm a first-timer
    to this. Any help would be much appreciated.
    Here is my code:

    Hi
    I was reading your post and realized that I had the same
    troubles the first time I tried to setup a record deletion page.
    I hope the following helps.
    What I ended up doing was to set up 3 pages..
    1) a user list page of all users in the users table
    2) a confirmation page to show user info
    3) a delete page which does the actual deletion
    This first page was a simple repeat region table showing the
    entire list of users in the database table. I linked the username
    to the conformation page with a simple URL Parameter to isolate the
    user I want to delete
    Here is the code
    <a href="admin_users_delconfirm.php?id=<?php echo
    $row_rsUsers['id']; ?>
    The on the confirmation page I have a delete button graphic
    which is linked to the delete page in the same way.
    Code:
    <a href="admin_users_delete.php?id=<?php echo
    $row_rsUsers['id']; ?>
    Finally on the delete page I applied the" delete record"
    server behaiviour so that the deletion is done when the page loads.
    You can also have it redirect back to the master list of users when
    the deletion is done.
    It may seem a little redundant to have 3 pages, but the
    purpose of the 2nd page is to give the user an opportunity to
    change their mind and also to remind them that the delete action
    cannot be undone.
    I hope this helps you.
    Good Luck and Good Coding!

  • Deleting Record from Database in PHP

    I'm trying to figure out how to delete a record from my
    database. I already have a recordset with my form selected. But
    when I try to add "Delete Record," I can never seem to figure out
    why it won't delete anything when I load the page in a browser, it
    won't even go to the page I told it to go to after it deletes a
    record. My guess is it's what I'm entering in the "Delete Record"
    part of it, any help would be great. Also, my id is primary key if
    that helps. Thanks ahead of time.

    edwin@aw wrote:
    > However, whenever I click on the hyperlink, the link
    will becomes
    >
    http://www.domain.com/www.LinkFromDatabase.com.
    Why it always append the web
    > site's address?? Do I miss something?
    This is happening because your link doesn't begin with
    http://.
    > echo "<a href='$link' target='_blank'> $link
    </a>";
    This should be echo "<a href='
    http://$link' target='_blank'> $link
    </a>";
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • PHP/MySQL Insert Record

    I've got a multi page form that carries values across
    multiple pages with the use of Hidden Fields and then on last page
    inserts the record into a MySQL database (for this I used the built
    in Insert Record function of dreamweaver). My problem is that it
    works well when using Internet Explorer, values are carried forward
    and everything is inserted successfully to the database.
    But, when using Mozilla Firefox it looks as if it works, I
    get the confirmation at the end, but the record is not being
    inserted to the database. I've worked through this step by step and
    the values are being carried across in the hidden fields but it
    just will not insert anything to the database.
    Has anyone got any ideas??
    Thank you in advance.

    Cade06 wrote:
    > Thanks alot for your reply, but I am completely new to
    MySQL, and I am not
    > quite sure how the syntax works. When you say " WHERE
    landlord_username =
    > 'whatever' "I'm not sure what needs to go in the
    'whatever' portion of the
    > code. Do I need to insert static text here or something
    else? I am totally out
    > of my element here, sorry :-/
    It's probably not so much MySQL syntax that's the problem for
    you, but a
    lack of understanding how to work with Dreamweaver
    recordsets, server
    behaviors, and sessions. Building database-driven sites with
    Dreamweaver
    isn't difficult, but there are a lot of things involved.
    The Log In User server behavior automatically creates a
    session variable
    called $_SESSION['MM_Username']. You can use this as a
    parameter to pass
    to the SQL query in the Advanced Recordset dialog box. In the
    SQL area
    you would type (I'm guessing the name of your table and the
    username
    column):
    SELECT landlord_id FROM landlords
    WHERE landlord_username = 'col1'
    Then click the plus button above the Variables area, and
    create a
    Parameter with the following values:
    Name: col1
    Default value: 1
    Runtime value: $_SESSION['MM_Username']
    You can then extract the result of the recordset, and assign
    it to a
    session variable like this:
    $_SESSION['landlord_id'] = $row_recordsetName['landlord_id'];
    > Also, I understand that I need to do this on the login
    page, but do I need to
    > define the recordset again on the add_site page as well?
    I guess I'm still not
    > quite clear on how I specify the session variable as the
    value that needs to be
    > entered in the sites table as the landlord_ID.
    As long as the session is still valid (which it would be if
    you use
    Restrict Access to Page), you will always have access to that
    landlord's
    id through $_SESSION['landlord_id'].
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • [php+mysql] how to get the inserted record ID?

    Hi all,
    I have a standard php page that inserts a record in a mysql
    db.
    is there a way to save the record ID on a session variable
    just after
    storing the new record on the db? I would like to be able to
    get this
    record ID on a specific page where I would allow the user to
    print
    this specific record, by filtering the db by this session
    variable.
    I can use MX Kollection (last version, not PRO).
    TIA
    tony

    >...
    >mysql_query(...);
    >$_SESSION['lastId'] = mysql_insert_id();
    >HTH
    >Micha
    Hi Micha,
    I think that it a bit more complicated.
    I can't find any occurrence of that mysql call.
    I used MX Kollection INSERT FORM function.
    here is the code (partially):
    ===============================
    <? // Load the common classes
    require_once('../includes/common/KT_common.php');
    // Load the tNG classes
    require_once('../includes/tng/tNG.inc.php');
    // Make a transaction dispatcher instance
    $tNGs = new tNG_dispatcher("../");
    // Make unified connection variable
    $conn_test_conn = new KT_connection($tes_conn,
    $database_test_conn);
    // Start trigger
    $formValidation = new tNG_FormValidation();
    $tNGs->prepareValidation($formValidation);
    // End trigger
    // Make an insert transaction instance
    $ins_rl_test = new tNG_insert($conn_test_conn);
    $tNGs->addTransaction($ins_rl_test);
    // Register triggers
    $ins_rl_test->registerTrigger("STARTER",
    "Trigger_Default_Starter", 1,
    "POST", "KT_Insert1");
    $ins_rl_test->registerTrigger("BEFORE",
    "Trigger_Default_FormValidation", 10, $formValidation);
    $ins_rl_test->registerTrigger("END",
    "Trigger_Default_Redirect", 99,
    "2.php?idp1={id_rl}");
    // Add columns
    $ins_rl_test->setTable("rl_test");
    $ins_rl_test->addColumn("nome_rl", "STRING_TYPE", "POST",
    "nome_rl");
    $ins_rl_test->addColumn("cognome_rl", "STRING_TYPE",
    "POST",
    "cognome_rl");
    $ins_rl_test->addColumn("datanascita_rl", "DATE_TYPE",
    "POST",
    "datanascita_rl");
    $ins_rl_test->addColumn("cancellato_rl", "STRING_TYPE",
    "POST",
    "cancellato_rl");
    $ins_rl_test->addColumn("cancellato_data_rl", "DATE_TYPE",
    "POST",
    "cancellato_data_rl");
    $ins_rl_test->setPrimaryKey("id_rl", "NUMERIC_TYPE");
    // Execute all the registered transactions
    $tNGs->executeTransactions();
    // Get the transaction recordset
    $rsrl_test = $tNGs->getRecordset("rl_test");
    $row_rsrl_test = mysql_fetch_assoc($rsrl_test);
    $totalRows_rsrl_test = mysql_num_rows($rsrl_test);
    ?>
    ===========================
    as you can see, all data is processed by other functions in
    other
    included files.... :(.
    I think I need to better understand the TNG engine and try to
    create a
    little trigger that creates a session variable just after
    inserting
    the record in the db.
    I already tried to do so, honestly, but with really poor
    results.
    Ciao Micha. ;).
    tony

  • [php+mysql] how to insert 3 records at once and print out all 3 records?

    Hi all,
    I have to create a serie of pages that allow the user to:
    1- Insert 3 records in a mysql db at once
    2- click NEXT
    3- viewverify//print the data that he has entered (all 3
    records)
    4- click PRINT
    5- click FINISH
    then, restart from 1
    What is the best way to do this?
    TIA for any suggestion.
    tony

    The best way is usually to use a stored procedure. Do you
    know if the version of MySQL you are using supports sprocs?

  • How to Insert a record into a MySql database.

    Hi,
    In an earlier question I was advised to use the Adobe extension to get access to database connectivity and server behaviours.
    That extension is now installed. Whether it is functional is another question.
    To chewck it out I follwed exactly the steps set out in Lessons 5 and 6 of Dreamweaver CS5 with PHP
    When trying to make a database connection I am still getting the 404 error I mentioned in an earlier email. However if I type the database name (phpcs5) into the “select database” box and test it says I connected successfully and I can see the user’s table in the database panel.
    So far apparently so good.
    I have created the cs5wtite and cs5read connections to the phpcs5 database
    I set up the insert record behaviour using “Form1!, “cs5write”, “users”,
    Everything went as per the manual, the file turned aqua in Live view.
    I entered data and ctrl/clicked “Sign me up” button and nothing happened.
    No data was entered into the database and I was not passed to login.php.
    I deleted everything from the computer, restarted the pc and started again from scratch.
    The result was the same. Nothing
    My one concern was line 49  $insertGoTo = " login.php";
    The file is in registration so I changed to $insertGoTo = "registration/login.php";
    but that made no difference.
    Is there any logging or error reporting I can use to see where it is going wrong?
    This is the add user page generated
    <?php require_once('../Connections/cs5write.php'); ?>
    <?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_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO users (first_name, family_name, username, password) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['first_name'], "text"),
                           GetSQLValueString($_POST['surname'], "text"),
                           GetSQLValueString($_POST['username'], "text"),
                           GetSQLValueString($_POST['password'], "text"));
      mysql_select_db($database_cs5write, $cs5write);
      $Result1 = mysql_query($insertSQL, $cs5write) or die(mysql_error());
      $insertGoTo = "login.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    ?>
    <!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="Content-Type" content="text/html; charset=utf-8" />
    <title>Add new user</title>
    <link href="../../styles/users.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <h1>Sign Up Now</h1>
    <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
      <fieldset>
        <legend>Just a few details and you&rsquo;re in</legend>
        <p>
          <label for="first_name">First name:</label>
          <input type="text" name="first_name" id="first_name" />
        </p>
        <p>
          <label for="surname">Family name:</label>
          <input type="text" name="surname" id="surname" />
        </p>
        <p>
          <label for="username">Username:</label>
          <input type="text" name="username" id="username" />
        </p>
        <p>
          <label for="password">Password:</label>
          <input type="password" name="password" id="password" />
        </p>
        <p>
          <label for="conf_password">Confirm password:</label>
          <input type="password" name="conf_password" id="conf_password" />
        </p>
        <p>
          <input type="submit" name="add_user" id="add_user" value="Sign me up!" />
        </p>
      </fieldset>
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    </body>
    </html>
    This is the connection page
    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_cs5write = "localhost";
    $database_cs5write = "phpcs5";
    $username_cs5write = "cs5write";
    $password_cs5write = "Smp??2014";
    $cs5write = mysql_pconnect($hostname_cs5write, $username_cs5write, $password_cs5write) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>
    I understand this solution is a wokraround Adobe privided whist deprecating its use.
    In the earlier question I asked if there was another way to work with a database. Someone posted a link to an Object orientated solution but It was way beyond my coding abilities. I wonder are there any other solutions out there?
    Thanks for any input

    Hi,
    Thanks for the test.
    I used your amendment but still got nothing, no record in database and not sent to login page..
    I also tried this code below. It returns "Record added to database" but it was not.
    Something strange going on.
    <?PHP
    $user_name = "cs5write";
    $password = "Smp??2014";
    $database = "phpcs5";
    $server = "127.0.0.1";
    $db_handle = mysql_connect($server, $user_name, $password);
    $db_found = mysql_select_db($database, $db_handle);
    if ($db_found) {
    $SQL = "INSERT INTO users (first_name, surame, username, password) VALUES) VALUES ('Albert', 'Dent', 'hitchiker', 'space')";
    $result = mysql_query($SQL);
    mysql_close($db_handle);
    print "Records added to the database";
    else {
    print "Database NOT Found ";
    mysql_close($db_handle);
    ?>

  • [DW MX 2004] DELETE RECORD

    Hi,
    I can't DELETE RECORD in LOCAL SERVER (MySQL Server 5.0)
    and REMOTE SERVER , but INSERT AND UPDATE WORKS.
    Page code is
    <?php require_once('../Connections/connpuntofermo.php');
    ?>
    <?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;
    if ((isset($_GET['ID'])) && ($_GET['ID'] != "")) {
    $deleteSQL = sprintf("DELETE FROM news WHERE ID=%s",
    GetSQLValueString($_GET['ID'], "int"));
    mysql_select_db($database_connpuntofermo, $connpuntofermo);
    $Result1 = mysql_query($deleteSQL, $connpuntofermo) or
    die(mysql_error());
    $deleteGoTo = "ok-cancella.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
    header(sprintf("Location: %s", $deleteGoTo));
    mysql_select_db($database_connpuntofermo, $connpuntofermo);
    $query_rs_elenco = "SELECT ID, `data`, titolo FROM news ORDER
    BY ID DESC";
    $rs_elenco = mysql_query($query_rs_elenco, $connpuntofermo)
    or
    die(mysql_error());
    $row_rs_elenco = mysql_fetch_assoc($rs_elenco);
    $totalRows_rs_elenco = mysql_num_rows($rs_elenco);
    ?>
    <html><!-- InstanceBegin
    template="/Templates/template-adm.dwt"
    codeOutsideHTMLIsLocked="false" -->
    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>amministrazione Piadineria Punto
    Fermo</title>
    <!-- InstanceEndEditable --><meta
    http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1"><style
    type="text/css">
    <!--
    body {
    background-color: #CCD57B;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    -->
    </style>
    <link href="../css/style.css" rel="stylesheet"
    type="text/css">
    <style type="text/css">
    @import "news/domnews.css";
    </style>
    <script type="text/javascript"
    src="news/domnews.js"></script>
    <!-- InstanceBeginEditable name="head" --><!--
    InstanceEndEditable -->
    </head>
    <body>
    <table width="100%" height="100%" border="0"
    align="center" cellpadding="0"
    cellspacing="0">
    <tr>
    <td align="center" valign="middle"><table
    width="760" height="430"
    border="0" align="center" cellpadding="0" cellspacing="1"
    bgcolor="#A7B339">
    <tr>
    <td width="779" align="left" valign="middle"
    bgcolor="#FFFFCC"><table width="760" height="334"
    border="0" cellpadding="0"
    cellspacing="0">
    <tr>
    <td align="center"
    class="body"><strong>AMMINISTRAZIONE SITO
    PUNTO FERMO </strong></td>
    </tr>
    <tr>
    <!-- InstanceBeginEditable name="header" --><td
    height="42"
    align="center" valign="top" class="body"><a
    href="menu.php"
    class="body">torna
    a men&ugrave; principale </a></td>
    <!-- InstanceEndEditable --> </tr>
    <tr>
    <!-- InstanceBeginEditable name="body" -->
    <td align="center" valign="top"
    class="body"><p>ELENCO NEWS
    INSERITE</p>
    <table width="505" border="0" cellpadding="5"
    cellspacing="1"
    bgcolor="#999999" class="body">
    <tr bgcolor="#FFFFA8">
    <td>ID</td>
    <td width="104">DATA</td>
    <td width="134">TITOLO</td>
    <td width="110"> </td>
    <td width="112"> </td>
    </tr>
    <?php do { ?>
    <tr align="left" valign="top" bgcolor="#FFFFCC">
    <td><?php echo $row_rs_elenco['ID'];
    ?></td>
    <td><?php echo $row_rs_elenco['data'];
    ?></td>
    <td><?php echo $row_rs_elenco['titolo'];
    ?></td>
    <td><a href="mod-news.php?ID=<?php echo
    $row_rs_elenco['ID']; ?>"
    class="body">MODIFICA</a></td>
    <td><form name="elimina1" method="post"
    action="">
    <input type="submit" name="Submit" value="ELIMINA">
    </form></td>
    </tr>
    <?php } while ($row_rs_elenco =
    mysql_fetch_assoc($rs_elenco)); ?>
    </table>
    <p>  </p></td>
    <!-- InstanceEndEditable --> </tr>
    <tr>
    <td> </td>
    </tr>
    </table></td>
    </tr>
    </table> </td>
    </tr>
    </table>
    </body>
    <!-- InstanceEnd --></html>
    <?php
    mysql_free_result($rs_elenco);
    ?>
    Where is error?
    Thanks.

    MX 2004 was always a bit "gummy" on this.  Instead of using the DW wizard, I downloaded a free version of Microsoft SQL Server Express Edition.  I use that for all table Inserts, Updates,etc.   This accesses the tables directly on the server.  Nothing needs to be synced, put, gotten or whatever.  Use DW for Form and UI creation and making prebuilt queries.
    Hope that helps
    Jerry H

  • Delete record works too well !

    I've done this before successfully several times but now something strange is happening.  I've stared at this for a couple of hours now and don't see what I'm missing, it must be something blindingly obvious.
    I created a page showing all records in a table using a repeating region. I added a column with a big red X image so that users can delete the record by clicking on the "X". This links to a delete page which displays the record and asks "Are you sure" the user clicks "Yes" and the record should be deleted.
    What's happening is when the user clicks on the big red X the record is deleted and control is returned back to the page showing all records. I know it's going to the confirmation page as I tried removing the Delete Record behavior and it successfully displays the record I want to delete. I tried creating a new delete page from scratch to delete the record just in case there was something left over from the page I started with to create the delete page in the first place, same result.
    Anyone have any clues? I'm using DW CS4, PHP, MySQL and Win 7
    Thanks

    oops sorry, here's the code for the delete page
    <?php require_once('../Connections/adminconnection.php'); ?>
    <?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;
    if ((isset($_GET['reservationnumber'])) && ($_GET['reservationnumber'] != "")) {
      $deleteSQL = sprintf("DELETE FROM dinner WHERE reservationnumber=%s",
                           GetSQLValueString($_GET['reservationnumber'], "int"));
      mysql_select_db($database_adminconnection, $adminconnection);
      $Result1 = mysql_query($deleteSQL, $adminconnection) or die(mysql_error());
      $deleteGoTo = "admin2.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
        $deleteGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $deleteGoTo));
    $colname_rsdeletedinntest = "-1";
    if (isset($_GET['reservationnumber'])) {
      $colname_rsdeletedinntest = $_GET['reservationnumber'];
    mysql_select_db($database_adminconnection, $adminconnection);
    $query_rsdeletedinntest = sprintf("SELECT * FROM dinner WHERE reservationnumber = %s", GetSQLValueString($colname_rsdeletedinntest, "int"));
    $rsdeletedinntest = mysql_query($query_rsdeletedinntest, $adminconnection) or die(mysql_error());
    $row_rsdeletedinntest = mysql_fetch_assoc($rsdeletedinntest);
    $totalRows_rsdeletedinntest = mysql_num_rows($rsdeletedinntest);
    ?>
    <!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="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="../styles/thrColLiqHdr.css" rel="stylesheet" type="text/css" />
    </head>
    <body class="oneColFixCtrHdr">
    <div id="container">
      <div id="header">
        <h1>Header</h1>
      <!-- end #header --></div>
      <div id="mainContent">
        <h1> Main Content </h1>
        <p>L</p>
        <p> </p>
        <table width="400" border="1">
          <tr>
            <td>res name</td>
            <td><?php echo $row_rsdeletedinntest['reservationname']; ?></td>
          </tr>
          <tr>
            <td>num in pty</td>
            <td><?php echo $row_rsdeletedinntest['numberinparty']; ?></td>
          </tr>
          <tr>
            <td>paid</td>
            <td><?php echo $row_rsdeletedinntest['amountpaid']; ?></td>
          </tr>
        </table>
        <p> </p>
        <p> </p>
        <form id="form1" name="form1" method="post" action="deletedinner.php">
          <label>are you sure
            <input type="submit" name="delete" id="delete" value="Submit" />
          </label>
        </form>
        <p> </p>
        <p>Donec nec libero.</p>
        <h2>H2 level heading </h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>
    <!-- end #mainContent --></div>
      <div id="footer">
        <p>Footer</p>
      <!-- end #footer --></div>
    <!-- end #container --></div>
    </body>
    </html>
    <?php
    mysql_free_result($rsdeletedinntest);
    ?>

  • Delete Record server behavior problem

    Hi all!
    I'm such a painful situation, that I can't figure out, why my
    Delete
    Record form don't work as supposed.
    It seems all things work (also gives message "You have
    successfully
    deleted the article."), but the problem is
    that in the MySQL (5) database real deletion doesn't
    occure...
    I was walking along with very nice tutorial
    (www.adobe.com/devnet/dreamweaver/articles/php_blog2_11.html)
    if someone has time to think about...
    I have all the steps (from the tutorial) done multiple times
    and
    result... no real deletion, despite "successfully deleted"
    text :(
    with regards,
    andreta

    Yeah! As always - if one is doing too much over and over,
    then it's too
    much of trouble.
    I used sample delete_art.php(premade by Marius) file instead
    of mine and
    it worked!
    If I was wondering what is different, then there was large
    amount of
    additional code in my file:
    In pre-made sample is 200 lines versus 242 in mine :(
    Differences(looked with Winmerge):
    MINE(not working): Working:
    (why my DW8 inserts session handling in this way?)
    1)
    $_SESSION['MM_Username'] = NULL;
    session_unregister('MM_Username');
    $_SESSION['MM_UserGroup'] = NULL;
    session_unregister('MM_UserGroup');
    $_SESSION['PrevUrl'] = NULL;
    unset($_SESSION['MM_Username']);
    unset($_SESSION['MM_UserGroup']);
    unset($_SESSION['PrevUrl']);
    2)
    if (!isset($_SESSION)) { session_start();
    session_start();
    3)
    in NONworking: (in WORKING - nothing )
    (NB! this was a double-code - i think because of the redoings
    (?recordset deleting & recreating?) )
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "",
    $theNotDefinedValue = "")
    $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;
    4)
    NONworking:
    <!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"><!--
    InstanceBegin
    template="/Templates/admintemplate.dwt.php"
    codeOutsideHTMLIsLocked="false" -->
    Working:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN"
    http://www.w3.org/TR/html4/loose.dtd">
    <html>
    5)
    NonW:
    <?php do { ?>
    <tr class="topheader">
    <td><?php echo $row_rsDeletedArticle['title_art'];
    ?></td>
    Working:
    <tr class="topheader">
    <td><?php echo $row_rsDeletedArticle['title_art'];
    ?></td>
    6)
    NONW:
    <td colspan="3"><?php echo
    $row_rsDeletedArticle['text_art']; ?></td>
    </tr>
    <tr>
    <td colspan="3"> </td>
    </tr>
    <?php } while ($row_rsDeletedArticle =
    mysql_fetch_assoc($rsDeletedArticle)); ?>
    </table>
    <table width="30%" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td><form id="delete" name="delete" method="post"
    action="delete_art.php">
    <input name="yes" type="submit" id="yes" value="yes"
    />
    <input name="id_art" type="hidden" id="id_art"
    value="<?php echo $row_rsDeletedArticle['id_art']; ?>"
    />
    </form>
    </td>
    <td><form id="cancel" name="cancel" method="post"
    action="list_art.php">
    <input name="no" type="submit" id="no" value="No" />
    </form>
    </td>
    </tr>
    </table>
    <?php } // Show if recordset not empty ?>
    <?php if ($totalRows_rsDeletedArticle == 0) { // Show if
    recordset empty ?>
    <p>You have successfully deleted the
    article.</p>
    <form id="back" name="back" method="post"
    action="list_art.php">
    <input name="back" type="submit" id="back" value="Back"
    />
    </form>
    <?php } // Show if recordset empty
    ?><p>  </p>
    <!-- InstanceEndEditable --></td>
    Working:
    <td colspan="2"><p><?php echo
    $row_rsDeletedArticle['text_art']; ?></p></td>
    </tr>
    <tr>
    <td colspan="2"><table width="15%" border="0"
    cellspacing="0" cellpadding="0">
    <tr>
    <td><form action="delete_art.php" method="post"
    name="delete" id="delete">
    <input name="yes" type="submit" id="yes" value="Yes">
    <input name="id_art" type="hidden" id="id_art"
    value="<?php echo $row_rsDeletedArticle['id_art'];
    ?>">
    </form></td>
    <td><form action="list_art.php" method="post"
    name="cancel" id="cancel">
    <input name="no" type="submit" id="no" value="No">
    </form></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <?php } // Show if recordset not empty ?>
    <?php if ($totalRows_rsDeletedArticle == 0) { // Show if
    recordset
    empty ?>
    <p>You have successfully deleted the
    article.</p>
    <form action="list_art.php" method="post" name="back"
    id="back">
    <input name="back" type="submit" id="back"
    value="Back">
    </form>
    <?php } // Show if recordset empty ?>
    <p>  </p>
    <p> </p> <p> 
    </p></td>
    </tr>
    Boo-oo-hh!
    It's enough for now
    Please can someone give me advices about what is wrong with
    the nonworking
    (I deleted the section 3 from nonworking but it anyway
    doesn't work)
    AndreTa wrote:
    > Oh, sorry!
    >
    > additional information - working with DW8.0.2, PHP
    5.1.6, and with the
    > "blog" database with MySQL 4.1.14
    > (have also MySQL 5.0 - havn't tried with this... I'll do
    it after sweet
    > dreams and hard workday i.e. tomorrow)
    > In local PC WinXP, Apache 2.2.3
    >
    > andreta
    >
    >

  • PHP/MySql Error Message

    I've posted this before and didn't get the answer that I need, probably because I didn't post all of my codes. I am using PHP/MySql.  I created a website that has several forms.  When I process three of the forms, I get the error messages below:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Condition, Length, Color, City, `State`, Email, Photo) VALUES ('29', '4', 'Used'' at line 1.
    Below I am posting the codes.  Hopefully, this time I posted everything that I should have so that I can get assistance.   
    FORM
    <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="individual" class="individual" id="individual">
      <table width="594" border="0" class="test">
      <tr></tr>
      <tr>
        <td width="166" class="td">Posting Title</td>
        <td colspan="3"><span id="sprytextfield1">
          <label>
            <input name="Posting Title" type="text" class="test" id="Posting Title" size="35" />
            </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">Price</td>
        <td colspan="3"><span id="sprytextfield2">
          <label>
            <input name="price" type="text" class="test" id="price" size="35" />
          </label>
          <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
      </tr>
      <tr>
        <td class="td">Size(s)</td>
        <td colspan="3"><label>
          <select name="size" size="1" multiple="multiple" class="test" id="size">
    <option>0</option>
            <option>2</option>
            <option>4</option>
            <option>6</option>
            <option>8</option>
            <option>10</option>
            <option>12</option>
            <option>14</option>
            <option>16</option>
            <option>18</option>
            <option>20</option>
            <option>22</option>
            <option>24</option>
            <option>26</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Condition</td>
        <td colspan="3"><label>
          <select name="Condition" class="test" id="Condition">
    <option>New</option>
            <option>Used</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Length</td>
        <td colspan="3"><label>
          <select name="Length" class="test" id="Length">
    <option>Long</option>
    <option>Short</option>
    <option>Mid-Length</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Color</td>
        <td colspan="3" class="td"><span id="sprytextfield5">
          <label>
            <input name="Color" type="text" class="test" id="Color" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">City</td>
        <td class="td"><span id="sprytextfield4">
          <label>
            <input name="City" type="text" class="test" id="City" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
        <td class="td"> </td>
        <td class="td"> </td>
      </tr>
      <tr>
        <td class="td">State</td>
        <td colspan="3"><label>
          <select name="State" class="test" id="State">
            <option>AL</option>
            <option>AK</option>
            <option>AZ</option>
            <option>AR</option>
            <option>CA</option>
            <option>CO</option>
            <option>CT</option>
            <option>DE</option>
            <option>DC</option>
            <option>FL</option>
            <option>GA</option>
            <option>HI</option>
            <option>ID</option>
            <option>IL</option>
            <option>IN</option>
            <option>IA</option>
            <option>KS</option>
            <option>KY</option>
            <option>LA</option>
            <option>ME</option>
            <option>MD</option>
            <option>MA</option>
            <option>MI</option>
            <option>MN</option>
            <option>MS</option>
            <option>MO</option>
            <option>MT</option>
            <option>NE</option>
            <option>NV</option>
            <option>NH</option>
            <option>NJ</option>
            <option>NM</option>
            <option>NY</option>
            <option>NC</option>
            <option>ND</option>
            <option>OH</option>
            <option>OK</option>
            <option>OR</option>
            <option>PA</option>
            <option>RI</option>
            <option>SC</option>
            <option>SD</option>
            <option>TN</option>
            <option>TX</option>
            <option>UT</option>
            <option>VT</option>
            <option>VA</option>
            <option>WA</option>
            <option>WV</option>
            <option>WI</option>
            <option>WY</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Email</td>
        <td colspan="3"><span id="sprytextfield3">
          <label>
            <input name="Email" type="text" class="test" id="Email" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Confirm Email</td>
        <td colspan="3"><span id="spryconfirm1">
          <label>
            <input name="Confirm Email2" type="text" class="test" id="Confirm Email2" size="35" />
          </label>
          <span class="confirmRequiredMsg">Required</span><span class="confirmInvalidMsg">The values don't match.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Photo(s)</td>
        <td colspan="3"><label>
          <input name="Photo" type="file" class="test" id="Photo" size="35" />
        </label></td>
      </tr>
      <tr>
        <td height="131" class="td">Additional Details</td>
        <td colspan="3"><label>
          <textarea name="Additional Details" cols="40" rows="6" class="test" id="Additional Details"></textarea>
        </label></td>
      </tr>
      </table>
      <p>
        <label>
          <input name="Submit" type="submit" class="test" id="Submit" value="Post" />
        </label>
      </p>
      <input type="hidden" name="MM_insert" value="individual" />
    </form>
    SERVER BEHAVIOR
    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_insert"])) && ($_POST["MM_insert"] == "individual")) {
      $insertSQL = sprintf("INSERT INTO donations (postingTitle, `size`, condition, length, color, city, `state`, email, photo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['Posting Title'], "text"),
                           GetSQLValueString($_POST['size'], "text"),
                           GetSQLValueString($_POST['Condition'], "text"),
                           GetSQLValueString($_POST['Length'], "text"),
                           GetSQLValueString($_POST['Color'], "text"),
                           GetSQLValueString($_POST['City'], "text"),
                           GetSQLValueString($_POST['State'], "text"),
                           GetSQLValueString($_POST['Email'], "text"),
                           GetSQLValueString($_POST['Photo'], "text"));
      mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
      $Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());
      $insertGoTo = "donations.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    DATABASE CONNECTION
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_bridesmaidsrack_db = "localhost";
    $database_bridesmaidsrack_db = "bridesmaidsrack";
    $username_bridesmaidsrack_db = "";
    $password_bridesmaidsrack_db = "";
    $bridesmaidsrack_db = mysql_pconnect($hostname_bridesmaidsrack_db, $username_bridesmaidsrack_db, $password_bridesmaidsrack_db) or trigger_error(mysql_error(),E_USER_ERROR);

    Hi David,
    I did as you recommended. For good measure, I even changed the case of the letters to make sure that they coincide with exactly what's in the database.  I still kept getting the same error message.  So I deleted the recordset and attempted to recreate it.  When I attempted to recreate the record set, I got the following error message: "RangeError: invalid array length".  My codes are listed below:
    Form:
    <form method="POST" enctype="multipart/form-data" name="individual" class="individual" id="individual">
      <table width="594" border="0" class="test">
      <tr></tr>
      <tr>
        <td width="166" class="td">Posting Title</td>
        <td colspan="3"><span id="sprytextfield1">
          <label>
            <input name="posting_title" type="text" class="test" id="posting_title" size="35" />
            </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">Size(s)</td>
        <td colspan="3"><label>
          <select name="size" size="1" multiple="multiple" class="test" id="size">
      <option>0</option>
            <option>2</option>
            <option>4</option>
            <option>6</option>
            <option>8</option>
            <option>10</option>
            <option>12</option>
            <option>14</option>
            <option>16</option>
            <option>18</option>
            <option>20</option>
            <option>22</option>
            <option>24</option>
            <option>26</option>
            </select>
          <span class="Text">To select multiple sizes, hold ctrl and select each size.</span></label></td>
      </tr>
      <tr>
        <td class="td">Condition</td>
        <td colspan="3"><label>
          <select name="condition" class="test" id="condition">
    <option>New</option>
            <option>Used</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Length</td>
        <td colspan="3"><label>
          <select name="length" class="test" id="length">
    <option>Long</option>
    <option>Short</option>
    <option>Mid-Length</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Color(s)</td>
        <td colspan="3" class="td"><span id="sprytextfield5">
          <label>
            <input name="color" type="text" class="test" id="color" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">City</td>
        <td class="td"><span id="sprytextfield4">
          <label>
            <input name="city" type="text" class="test" id="city" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
        <td class="td"> </td>
        <td class="td"> </td>
      </tr>
      <tr>
        <td class="td">State</td>
        <td colspan="3"><label>
          <select name="state" class="test" id="state">
            <option>AL</option>
            <option>AK</option>
            <option>AZ</option>
            <option>AR</option>
            <option>CA</option>
            <option>CO</option>
            <option>CT</option>
            <option>DE</option>
            <option>DC</option>
            <option>FL</option>
            <option>GA</option>
            <option>HI</option>
            <option>ID</option>
            <option>IL</option>
            <option>IN</option>
            <option>IA</option>
            <option>KS</option>
            <option>KY</option>
            <option>LA</option>
            <option>ME</option>
            <option>MD</option>
            <option>MA</option>
            <option>MI</option>
            <option>MN</option>
            <option>MS</option>
            <option>MO</option>
            <option>MT</option>
            <option>NE</option>
            <option>NV</option>
            <option>NH</option>
            <option>NJ</option>
            <option>NM</option>
            <option>NY</option>
            <option>NC</option>
            <option>ND</option>
            <option>OH</option>
            <option>OK</option>
            <option>OR</option>
            <option>PA</option>
            <option>RI</option>
            <option>SC</option>
            <option>SD</option>
            <option>TN</option>
            <option>TX</option>
            <option>UT</option>
            <option>VT</option>
            <option>VA</option>
            <option>WA</option>
            <option>WV</option>
            <option>WI</option>
            <option>WY</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Email</td>
        <td colspan="3"><span id="sprytextfield3">
          <label>
            <input name="email" type="text" class="test" id="email" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Confirm Email</td>
        <td colspan="3"><span id="spryconfirm1">
          <label>
            <input name="confirm_email2" type="text" class="test" id="confirm_email2" size="35" />
          </label>
          <span class="confirmRequiredMsg">Required</span><span class="confirmInvalidMsg">The values don't match.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Photo(s)</td>
        <td colspan="3"><label>
          <input name="Photo" type="file" class="test" id="Photo" size="35" />
        </label></td>
      </tr>
      <tr>
        <td height="131" class="td">Additional Details</td>
        <td colspan="3"><label>
          <textarea name="Additional Details" cols="40" rows="6" class="test" id="Additional Details"></textarea>
          <input name="hiddenField" type="hidden" id="hiddenField" value="Date" />
        </label></td>
      </tr>
      </table>
      <p>
        <label>
          <input name="Submit" type="submit" class="test" id="Submit" value="Post" />
        </label>
      </p>
    </form>
    Server Behavior
    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_insert"])) && ($_POST["MM_insert"] == "individual")) {
      $insertSQL = sprintf("INSERT INTO donations (posting_title, `size`, condition, length, color, city, `state`, email, photo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['posting_title'], "text"),
                           GetSQLValueString($_POST['size'], "text"),
                           GetSQLValueString($_POST['condition'], "text"),
                           GetSQLValueString($_POST['length'], "text"),
                           GetSQLValueString($_POST['color'], "text"),
                           GetSQLValueString($_POST['city'], "text"),
                           GetSQLValueString($_POST['state'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['Photo'], "text"));
      mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
      $Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());
      $insertGoTo = "donations.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));

  • PHP / MySQL help

    Hello all,
    I've got an update record form on one of my pages (it is a
    php / MySQL site). I followed the tutorial in dreamweaver 8, it
    works, but it does not work like I want it to work.
    I am hoping that when a user logs into the site, and they
    want to update their information, they can go to a page that has an
    update record form. This form will have all the fields empty. When
    the user enters information, only the fields that have been entered
    will update the record in the database (and all of the fields that
    are left blank will have no effect on the record in the database).
    How it is now, when the user goes to that page, all the text
    fields are filled with the information contained in the database.
    If they make a mistake, and delete any of those fields, that
    information will be deleted from the database.
    Is this possible to do? If so, is there a tutorial that I
    have not found yet that I can learn how to do this?
    Thank you

    >Is this possible to do?
    Sure it's possible, but I don't really think it's necessary.
    What if the user wants to completely remove the contents of the
    field? And if you don't want to allow that, then you should
    validate those fields anyway.
    Another workflow would be to have the form retrieve the
    database row into static text fields, so at least the user can see
    what is stored. Adjacent to the static fields would be normal text
    fields that they can enter text into if they want to make changes.
    Of course your form processing script would then need to evaluate
    each field for contents. It would then dynamically build the update
    sql based on the filled in fields. I don't know of a specific
    tutorial, but if you know sql and php it should be a piece of
    cake.

Maybe you are looking for

  • Bex Query is not working in portal

    Dear Experts, i have uploaded BI master role into portal, By default Bex Queries are assgined to Master Role. when I clcik on preview for particular Bex Query, it's working fine. but after assigning the master role to end user, that same Bex Query is

  • Can Drop Ship Warehouse be Utilized for Commission Only Business?

    Our company has a small percentage of business where we act as a broker only.  We process the customer orders, send the vendor POs and monitor the shipments, but we do not pay the vendor or collect the payment from the customer.  The customer pays th

  • No GPS lock in the Dominican Republic

    I have installed this version of 3.06 on my Nokia 5230 Nuron ovi_maps_installer_3.06_11wk7_b11_s60_5.0_nocs_beta.sis which works very well in the USA. I have no data plan with T-mobile so I do not use any internet connectivity to assist the GPS. I we

  • How to install PL/SQL web tool kit for designer 6i

    HI, I was going through the tutorial supplied by the evaluation version of Designer provided at OTN. there it required PL/SQL web tool kit to be installed, but when I run the web tool kit generator, it gives me error. Where can I find the PL/SQL web

  • Had an Error Installing new iOS software, Now Ipad not recognized by itunes

    This morning I was updating the iPad with the latest software from itunes.  There was an error.  Now itunes doesn't recognize the iPad.  The screen on the iPad when it is plugged into the PC is the same one when you recieve a brand new iPad.  How do