Results 1 to 7 of 7

Thread: Updated a record

  1. #1

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    Updated a record

    Thanks for your help everyone...

    Right now, i have it where on one page, you click the ID, and it takes you to an "Update" Page.
    I wanted it to take the ID that was clicked on the other page, and pass it into the db query script, and bring back its values, i have that done.

    My problem is, i wanted it to put the queryed values into text box's so that the user can edit them, and then hit "update" and it will update that record in the DB.

    I cant seem to get the values from my query into text box's

    PHP Code:
    <?php $pasc_id $_REQUEST['pasc_id'?>
    <?   
      $request = "SELECT DISTINCT pasc_id,part_number,return_po,date_entered,part_notes FROM dss_returns where pasc_id = '$pasc_id'";  
      $query = mysql_query($request);  
      $num = mysql_num_rows($query);  
      while($data = mysql_fetch_array($query)){   
    echo '<td><a href="./Update_Part.php?pasc_id=' . $data['pasc_id'] . '">' .'   ' . $data['pasc_id'] . '</a>'. '</td>'.'<td>'.         $data['part_number'] .'</td>'.'<td>'. $data['return_po']. '</td>' .'<td>'. $data['date_entered']. '</td>' . '<td>' .  $data['part_notes'] . '</td></tr>'; 

    echo '<td><a href="./Update_Part.php?pasc_id=' . $data['pasc_id'] . '">' .'   ' . $data['pasc_id'] . '</a>'. '</td>';
    echo '<form action="Update_Part.php" method="post">';
    echo '<input type="text" name="partnumber" size="20" maxlenght="20" value=".<?php $data['part_number'?>."/>';
      }  
    ?>

  2. #2
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: Updated a record

    Change this
    PHP Code:
    value=".<?php $data['part_number'?>
    To this
    PHP Code:
    value=".<?php echo $data['part_number'?>
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  3. #3

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    Re: Updated a record

    it says i have an unexspected t variable error

    PHP Code:
    echo '<input type="text" name="partnumber" size="20" maxlenght="20" value=".<?php echo $data['part_number'?>."/>';

  4. #4
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: Updated a record

    my bad, I did not see the original echo in the line

    it needs to be
    PHP Code:
    echo '<input type="text" name="partnumber" size="20" maxlenght="20" value=".  $data['part_number']  ."/>'
    You don't need the <?php ?> around the $data['part_number']
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  5. #5

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    Re: Updated a record

    dohhh still an error:

    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Inetpub\jf1\a\php\Update_Part.php on line 35

  6. #6
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Updated a record

    you need to "end" the single quote before you can put your variable.

    this is a really simple mistake.. are you even reading the code you're putting in joefox?

    PHP Code:
    echo '<input type="text" name="partnumber" size="20" maxlenght="20" value="'.  $data['part_number']  .'"/>'

  7. #7
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: Updated a record

    yup, I was just copying and pasting his line, should have looked a little closer.
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

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