Connecting Tech Pros Worldwide Help | Site Map

View, Edit and Update data in MySql!

  #1  
Old May 24th, 2009, 08:41 PM
Newbie
 
Join Date: May 2009
Posts: 5
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!
  #2  
Old May 26th, 2009, 11:34 AM
Member
 
Join Date: May 2009
Posts: 81

re: View, Edit and Update data in MySql!


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:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(!isset($_GET['action'])) die("No action set.");
  3.  
  4. switch($_GET['action'])
  5. {
  6.      case "update":
  7.           $query = "UPDATE table SET somerow={$_GET['var1']} WHERE id={$_GET['id']}";
  8.           .......................
  9. }
  10. ?>
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.URLRequest

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.
  #3  
Old May 26th, 2009, 03:44 PM
Newbie
 
Join Date: May 2009
Posts: 5

re: View, Edit and Update data in MySql!


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Basic Tutorial Atli insights 5 August 20th, 2009 10:53 AM
Posting to a Web Form and Displaying the Result in Normal Browser David W. Fenton answers 13 April 9th, 2007 04:05 AM
Using arrays to take records from a html table and update database Ian Davies answers 16 July 29th, 2006 10:15 AM