Results 1 to 19 of 19

Thread: [RESOLVED] Update Code Help Please

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    Resolved [RESOLVED] Update Code Help Please

    Hi guys,

    I need some help if possible.

    On my update code it dosent work can anyone help me get it to update the database.

    This is what i have in the error.log file

    Code:
    [03-Dec-2008 10:15:11] PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/webspace/public_html/_update.php on line 20
    [03-Dec-2008 10:15:26] PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/webspace/public_html/_update.php on line 20
    [03-Dec-2008 10:16:04] PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/webspace/public_html/_update.php on line 20
    [03-Dec-2008 10:16:07] PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/webspace/public_html/_update.php on line 20
    [03-Dec-2008 10:21:07] PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/webspace/public_html/_update.php on line 16
    it just goes straight to this line once i click the button.

    PHP Code:
        echo "<p>record has been updated click </p> <a href=\"index.php\"> here </a> to continue"
    but record dosent change.

    edit.php

    PHP Code:
    <html>
    <?php
      error_reporting
    (0);
              
    $db mysql_connect("localhost","webspace_data","d82f1fc");
              
    mysql_select_db("webspace_data",$db);
              
    $id $_GET['id'];
              
    $result mysql_query("SELECT * FROM clients WHERE id=$id",$db);
              
    $myrow mysql_fetch_array($result);
     
    ?>

    <form action="_update.php" method="post" id="_editform">

    <p><b>First Name:</b>
    <input type="text" value="<?php echo $myrow['first'?>" name="first">
    <br>
    <b>Last Name:</b>
    <input type="text" value="<?php echo $myrow['last'?>" name="last">
    <br>
    <b>Date Got:</b>
    <input type="text" value="<?php echo $myrow['dategot'?>" name="dategot">
    <br>
    <b>Pay Date:</b>
    <input type="text" value="<?php echo $myrow['paydate'?>" name="paydate">
    <br>
    <b>Money Due:</b>
    <input type="text" value="<?php echo $myrow['money'?>" name="money">
    <br>
    <b>Phone Number:</b>
    <input type="text" value="<?php echo $myrow['phone'?>" name="phone">
    <br>
    <br>
    <inpyt type="hidden" name="id" value="<?php echo $id ?>" >
    <input type="submit" name="submit" value="Edit Clients Information ">
    <br>
    <br>
    Click <a href="index.php"> Here </a> to go back
    </form>
    </body>
    </html>

    _update.php

    PHP Code:
    <HTML>
    <BODY>
    <?PHP
    $_lnk 
    mysql_connect("localhost","webspace_data","d82f1fc");
    mysql_select_db("clients",$_lnk);
        
    //    print_r($_POST);

        
    $id $_POST['id'];
        
    $_first $_POST['first'];
        
    $_last $_POST['last'];
        
    $_dategot $_POST['dategot'];
        
    $_paydate    $_POST['paydate'];
        
    $_money   $_POST['money'];
            
    $_phone   $_POST['phone'];
    $_rs ="UPDATE clients 
                            SET clients.first ='
    $_first', 
                              clients.last ='
    $_last', 
                              clients.dategot ='
    $_dategot',
                              clients.paydate ='
    $_paydate', 
                              clients.money ='
    $_money',
                                                      clients.phone='
    $_phone', 
                            WHERE clients.id = '
    $id';";

        
    $query=mysql_query($_rs);
        echo 
    "<p>record has been updated click </p> <a href=\"index.php\"> here </a> to continue";
        
    //header("Location:index.php");

    ?>
    </BODY>
    </HTML>
    Last edited by Jamie_Garland; Dec 3rd, 2008 at 10:42 AM.
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

Posting Permissions

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



Click Here to Expand Forum to Full Width