View, Edit and Update data in MySql!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • renegade78
    New Member
    • May 2009
    • 5

    View, Edit and Update data in MySql!

    Hi,

    I was hoping someone could help me with this...

    I've set up a database that Flash communicates with through php. I can write to the db and view the information held in it.

    What I'm trying to do is view the data in an input text field (this works fine) and then if I edit the text, it will then update the db with the new info, overwriting the old data.

    Does that sound feasible or should I look for a different approach!

    Many thanks!
  • unauthorized
    New Member
    • May 2009
    • 81

    #2
    I'm not sure I get everything you said, but you can easily form queues to an SQL server using POST or GET vars.

    For example, you can have your code like this:

    Code:
    <?php
    if(!isset($_GET['action'])) die("No action set.");
    
    switch($_GET['action'])
    {
         case "update":
              $query = "UPDATE table SET somerow={$_GET['var1']} WHERE id={$_GET['id']}";
              .......................
    }
    ?>
    Then, you can update a row by simply requesting an URL like this: http://myserver/myscript.php?action=...&var1=sometext
    This is easily doable in AS using flash.net.URLRe quest

    However, security can be pretty tough issue when accessing databases like this. You would have to consider any possible of input that could be sent to the said script. For example, the above code is vulnerable to being hijacked through a simple SQL injection.

    Comment

    • renegade78
      New Member
      • May 2009
      • 5

      #3
      Thanks for that. I'll try it out! Much appreciated.

      Comment

      Working...