Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    6

    Unanswered: Form using PHP and MySQL

    I am new to php scripting I do have some background in programming. What I am looking to do is create an internal form that will allow a user to insert current inventories for multiple items. They will then be stored in the database, each item will be a record.

    Basically this form will be used to update inventory in several locations for the same items.

    What I am looking for are some suggestions on what I should do. Currently I have the user entering information into the form clicking submit and 104 records are being added to the database. 1 record for each item. After the initial inventory I would like the database to be updated with only the records that have been changed on the form. I have tried doing a simple UPDATE statement but it will not allow me to update multiple records. Any suggestions or queestions concerning this are welcomed.

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Form using PHP and MySQL

    Originally posted by joebob
    I am new to php scripting I do have some background in programming. What I am looking to do is create an internal form that will allow a user to insert current inventories for multiple items. They will then be stored in the database, each item will be a record.

    Basically this form will be used to update inventory in several locations for the same items.

    What I am looking for are some suggestions on what I should do. Currently I have the user entering information into the form clicking submit and 104 records are being added to the database. 1 record for each item. After the initial inventory I would like the database to be updated with only the records that have been changed on the form. I have tried doing a simple UPDATE statement but it will not allow me to update multiple records. Any suggestions or queestions concerning this are welcomed.
    Could you post that update query to the forum?

  3. #3
    Join Date
    Jun 2003
    Location
    Minnesota
    Posts
    61
    you can update multiple records...

    UPDATE table SET ladeda='this' WHERE record='this'

    in every row you could have a column called "record" and have "this" in it.
    Mr. Lars

  4. #4
    Join Date
    Apr 2004
    Posts
    6

    Re: Form using PHP and MySQL

    Originally posted by ika
    Could you post that update query to the forum?
    I tried this with no luck:

    $query = " UPDATE quantity (branch_number, pipe_id, quantity) SET

    ('$branch','001','$qty1'),
    ('$branch','002','$qty2')

    WHERE branch_number = $branch and pipe_id = pipe_id;

    That didn't work.

    I even tried:

    $query1="UPDATE quantity SET branch_number ='$branch', pipe_id = '001', quantity = '$qty1' WHERE branch_number = '$branch' and pipe_id = pipe_id" ;

    $query2="UPDATE quantity SET branch_number ='$branch', pipe_id = '002', quantity = '$qty2' WHERE branch_number = '$branch' and pipe_id = pipe_id";

    mysql_query($query1);
    mysql_query($query2);

    Any help would be appreciated!!

  5. #5
    Join Date
    Apr 2004
    Posts
    6
    Was able to figure that out but now I have another dilemma. Now I am stuck on only doing the update if the value of a field has changed. So that if they will not need to reinsert all 104 items after the first time.

Posting Permissions

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