Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    Allright, thanks to this forum i already managed to complete step 1 and 2 of my whishlist:
    1. showing data from a mysql database
    2. inserting new data into it.
    3. editing data
    4. deleting data

    I have some problems with step 3: editing data/
    I have the following php:
    Code:
    $type = $_POST['type'];
    $lengte = $_POST['lengte'];
    $sql = "UPDATE test SET type='$type',lengte='$lengte' WHERE id=$id";
    $result = mysql_query($sql);
    but this basically does the same as the insert, only it edits a specified record. So far no problem.

    My problem is: how can i get existing data from record x to be filled in into the form (in flash), for editting?
    I tried with
    Code:
    $sql = "SELECT * FROM test";
    However when i add WHERE id=$id i get an error.

  2.  

  3. #2
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    Try this:

    PHP Code:
    $sql "SELECT * FROM test WHERE id='$id'"
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  4. #3
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    ok,

    i seem to have an update problem with this:
    php:
    Code:
    $type = $_POST['type'];
    $lengte = $_POST['lengte'];
    $sql = "UPDATE test SET type='$type',lengte='$lengte' WHERE id=$id";
    $result = mysql_query($sql);
    then i am able to load into 2 input textfields the data from for example id=10. I change the text. Then i press this button:
    Code:
    on (press) {
       loadVariablesNum ("database.php?update=yes&id=10",0, "POST");
    }
    but the data does not update.

    However when i use the phpscript only (without goig via Flash):
    Code:
    $type = abc;
    $lengte = def;
    $id = 10;
    $sql = "UPDATE test SET type='$type',lengte='$lengte' WHERE id=$id";
    $result = mysql_query($sql);
    it does update id10 with abc and gef. WHat am i doing wrong this time?

    thanks!

  5. #4
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    2 possible things:

    First, press the button with the variables being static, not dynamic. Also try the non-flash way with dynamic variables, not static.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  6. #5
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    whats the difference between static and dynamic variables?

  7. #6
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    Static:
    $type = abc;

    Dynamic:
    $type = $_POST['type'];
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  8. #7
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    ok, but:
    1. how can i make the variable static in flash?
    2. if i use $_POST['type']; nutting will happen cause without Flash that variable is not defined?

  9. #8
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    When i run the php only (without flash)- with the dynamic variables nothing much really happens, and i get no error.
    But i have not a clue how to make variables static in Flash.

  10. #9
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    hmmm...

    When i run the following php:
    Code:
    $sql = "UPDATE test SET type='$type',lengte='$lengte' WHERE id=$id";
    $result = mysql_query($sql);
    by typing ....php?id=10&type=hallo&lengte=test

    nothing happens with id10, however type and lengte are defined via the URL. Whats wrong?

  11. #10
    Member
    Join Date
    Aug 2004
    Posts
    61
    Member #
    7339
    YIIIIHAAAAAAAAA!!!!

    Its working. I completed all 4 steps on my whishlist. I can view, edit, add and delete data in a MySQL database from within Flash ;-)
    Life is great ..........

    PS: watch it here: http://www.killerwhale.be/testing/database.html

    Thanks all for the help!


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:56 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com