A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: delete from sql Database Question

  1. #1
    Member
    Join Date
    May 2007
    Posts
    39

    delete from sql Database Question

    var deleting:String = "DELETE from residents WHERE firstName= 'bob' AND lastName = 'smith' " ;
    This delete statement works just fine however I am not able to figure out how to get input from text fields to replace the words "bob' and 'smith'
    I think its a question of where to place the String quotation marks....it beats me!
    Any help would be appreciated.
    Thanks

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    That line will delete the whole row in the database, I'm not sure why you are using it inside of flash I'm pretty sure it should be in the php file.
    like so : $deleting = "DELETE FROM residents WHERE firstName='bob' AND lastName='smith'";

    To replace or update data http://www.w3schools.com/php/php_mysql_update.asp

  3. #3
    Member
    Join Date
    May 2007
    Posts
    39
    Quote Originally Posted by fruitbeard View Post
    Hi,

    That line will delete the whole row in the database, I'm not sure why you are using it inside of flash I'm pretty sure it should be in the php file.
    like so : $deleting = "DELETE FROM residents WHERE firstName='bob' AND lastName='smith'";

    To replace or update data http://www.w3schools.com/php/php_mysql_update.asp
    I am attempting to write an Air for Desktop application using the Flash IDE. (Flash CC)
    There is a great deal of information concerning as3 and the sql database.
    However it is remarkable difficult to understand.
    I am pleased that the entire row is deleted. What I am looking for is the means to have the WHERE(conditions) determined by text from input textfields

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I don't use Air but if it's the same then you need to send the data to the php file.

    PHP Code:
    function sendData(e:MouseEvent):void
    {
        var 
    userVars:URLVariables = new URLVariables();
        
    userVars.firstName userName.text;
        
    userVars.lastName lastName.text;
        
    userVars.anotherData1 anotherName1.text;
        
    userVars.anotherData2 anotherName2.text;
        
    userVars.anotherData3 anotherName3.text;

        var 
    phpPath:String "youPHPFile.php";

        var 
    sendUrl:URLRequest = new URLRequest(phpPath);
        
    sendUrl.method URLRequestMethod.POST;
        
    sendUrl.data userVars;

        var 
    dataLoader:URLLoader = new URLLoader();
        
    dataLoader.dataFormat URLLoaderDataFormat.VARIABLES;
        
    dataLoader.addEventListener(Event.COMPLETEsuccess,false,0,true);
        
    dataLoader.addEventListener(IOErrorEvent.IO_ERRORfailed,false,0,true);
        
    dataLoader.load(sendUrl);
    }

    function 
    success(e:Event):void
    {
        if (
    e.target.data)
        {
            
    trace(e.target.data);
        }
        else
        {
            
    trace("An error occured");
        }
    }

    function 
    failed(e:IOErrorEvent):void
    {
        
    trace(e);


Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center