-1

Ok i have updated my Code, not getting any Errors but nothing is being updated on the mysql side nor on the PHP Front end.

I have even tried a Hard Coded Statment.

This section is at the Very top of my Php Viewer page..

<?php
/

    / IF RESQUEST IS EQUAL TO SUBMUIT
    if (isset($_REQUEST['submit']))
            {   
                $my_date = date("Y-m-d H:i:s");
                $order = uniqid();
                $FullName= $_REQUEST['fullname'];
                //Take in full Name and Split it into first and last name.
                list($fname, $lname ) = explode( ' ', $customerName, 2 );       
                $address = $_REQUEST['address'];
                $emailAddress = $_REQUEST['emailAddress'];
                $phoneNo = $_REQUEST['phoneNo'];


Below is my Sticky Forum which is getting the Information from the Database and putting it into the Text Fields 

    // STICKY FORM TO ALLOW USER TO UPDATE INFORMATION 
    if (isset($_REQUEST['up']))
        {
            $query_sticky = mysqli_query($connection,'SELECT * FROM orders WHERE id = "' . $_GET['id'] . '"');
            if(! $query_sticky )
    {
      die('Could not get data: ' . mysqli_error($connection)); // Could not find Order_id show Error
    }//end die error 
    else
        (isset($_REQUEST['update']));
        {
    while($row = mysqli_fetch_array($query_sticky, MYSQLI_ASSOC))
    {
        $row['id'];
        echo '<form action="" method="post">'

      Name:';
            echo'<input name="customerName" id="cname" type="text" required   value="'.$row['firstname']. " " .$row['lastname']. '" />';
           echo' <br/>
            <br/>
            Address:
           <textarea name="address" id = "caddress" type="text" rows="5" cols="30" required value="'.$row['address'].'" ></textarea>
            <br/>
            <br/>
            Email Address:
           <input name="emailAddress" type="email" required  value="'.$row['email']. '" />
            <br/>
            <br/>
            <br/>
            Phone Number:
             <input name="phoneNo" id="phoneNumber" type="text" required  value="'.$row['phone']. '" />
            <br/>
             <br/>
          <button type="submit" name="update" value="update" >update</button
      <div id="Submit">
        </form>
        <form action="order.php" method="delete">
        </form>';
    }//close if 
        }
    } // Close While 

here is my Update Section 

    if (isset($_REQUEST['update']))
    {
            $updateDB = "UPDATE orders SET student ='$_POST[student]', 
            firstname='John', lastname='wallace',
            email = '$_POST[emailAddress]', address = '$_POST[address]',
            phone = '$_POST[phoneNo]'
            WHERE 
            order_id ='$_GET[order_id]'";
            mysqli_query($connection, $updateDB);
        }//end update..     
        }//end PHP 
    ?>
Girish
  • 11,254
  • 3
  • 32
  • 48
Dave
  • 69
  • 9

1 Answers1

1

You were mixing up single and double quotes in your UPDATE query string. Try this instead:

$updateDB = "UPDATE test
SET email = '".@$_POST[$emailAddress]."',
address = '".@$_POST[$address]."',
phone = '".@$_POST[$phoneNo]."'
WHERE id = '".$_GET['id']."'";
Tim Biegeleisen
  • 387,723
  • 20
  • 200
  • 263