SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Update question

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Update question

    Hi,
    I have an orders table in a mysql database. Basically I want a drop down of the order numbers. When the user selects an order number, I want the page populated with the data based on that order number. The user can then make changes to any of the fields and then an UPDATE query will write the updated data.

    Two questions:

    1. What are your suggestions on doing this?

    2. Are there any tutorials nyone knows of on the subject?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You've got the logic, so turn it into code!

  3. #3
    SitePoint Zealot sajjad's Avatar
    Join Date
    May 2005
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    u have drop down list for order and that must be filled from database
    suppose ur table name is order (order_no (pk),order_name,order_date,etc)
    <select name="order">
    <? $query = "select * from order";
    $rs = mysql_query($query);
    while($row = mysql_fetch_array($rs,MYSQL_BOTH))
    {
    ?>
    <option value="<?=$row[0]?>">
    <?=$row[0]?></option>

    <?
    }
    ?></select>



    after that when u select the order number and submit ur post then there u reteive ur posted value means which order number is selected $_POST['order'] and get the content of the other table according to that order with select query using where clause to show the content


    make one hidden field in updated form which will be used for update record means which record of database needs to update

    sorry my english isn't good, but hopefully u understand it


Bookmarks

Posting Permissions

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