1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    james_D is on a distinguished road

      0  

    Default Unanswered: Save records to MySQL DB from Ext JS 4

    Unanswered: Save records to MySQL DB from Ext JS 4


    I need to know if there's a MVC tutorial (Video tutorial) that explains how to save some records to a MySQL database.

    The view should be simple with 3-4 text fields, and i should save those records to the MySQL DB.

  2. #2
    Sencha User
    Join Date
    Apr 2011
    Posts
    96
    Vote Rating
    3
    stimpy has a little shameless behaviour in the past

      0  

    Default


    Not that I have seen .

    Additonally connecting JS directly to a DB is terribly unsafe.

    You need some serverside lanage ( Java, PHP) to handle the basics.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    james_D is on a distinguished road

      0  

    Default


    Where could i start from. Is there a tutorial or a video tutorial i could start with ?

  4. #4
    Sencha User
    Join Date
    Apr 2011
    Posts
    96
    Vote Rating
    3
    stimpy has a little shameless behaviour in the past

      -1  

    Default


    http://lmgtfy.com/?q=extjs+mvc+mysql+tutorial

    You might try VIMEO if you really need a video

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    james_D is on a distinguished road

      0  

    Default


    I have tried google/youtube for tutorials, and since it didn't help me, I posted my question here. Thank you for your support.

  6. #6
    Sencha User
    Join Date
    Apr 2011
    Posts
    96
    Vote Rating
    3
    stimpy has a little shameless behaviour in the past

      -1  

    Default


    James

    Your question asked if there were any tutorials. That link results in many many tutorials with code samples .

    What is it that you are looking for that you are not finding ?

  7. #7
    Sencha User Izhaki's Avatar
    Join Date
    Apr 2009
    Location
    London
    Posts
    118
    Answers
    7
    Vote Rating
    13
    Izhaki will become famous soon enough

      0  

    Default


    Ext Direct and Grid demonstrates exactly that, step by step.

  8. #8
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,332
    Answers
    124
    Vote Rating
    83
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,
    You can save your formdata to the MySQL db by following steps:

    1. Send the ajax request from your .js file to the server code which can be in php. Ajax function code is following:
    Code:
    // sending your form data as querystring
    Ext.Ajax.request({
    	url: 'save-form.php?' + yourForm.getForm().getValues(true),
            success: function(response){
    		// place ur code here that should run on success
    	}
    });
    2. Now you need a server script that can save ur data in MySQL database.The server file code of .php file:
    Code:
    <?php 
           //make database connection 
    	mysql_connect("localhost", "YOUR USERNAME", "YOUR PASSWORD") or 
    	die("Could not connect: " . mysql_error()); 
    	mysql_select_db("YOUR DATABASE");
    	// get ur form data fields values by their names like following:
    	$name = $_GET['name'];   // getting value of form elements
    	$age = $_GET['age'];    // getting value of form elements
    	$insertCmd ; // define insert command with the get values to this variable
    	$result = mysql_query($insertCmd); 
    	echo $result;   // true on success & false if values not inserted
    } 
    ?>
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  9. #9
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    james_D is on a distinguished road

      0  

    Default


    What if i want to do a Select Statement with a Where clause. I am using POST and not GET

    PHP Code:
    mysql_select_db("myDB"$con);
    $resmysql_query("SELECT * FROM Country WHERE city='London'");
    $row mysql_fetch_array($res);
    echo 
    $row
    I am using this tutorial.

    The failed block gets executed. How can i resolve this ?

  10. #10
    Sencha User
    Join Date
    Oct 2011
    Location
    Vancouver, Canada
    Posts
    157
    Answers
    5
    Vote Rating
    13
    el_chief will become famous soon enough

      1  

    Default


    James,

    If you are doing this for real, then I would suggest using a PHP Framework (assuming you want to use PHP).

    Symfony is probably the best, mostly due to its integration with Doctrine ORM.

    Here's how it works:
    • ExtJS Grid has some new data in its store. You call store.sync().
    • The store uses its Writer to create JSON data from its in-memory Javascript data.
    • The store uses its Proxy to create an HTTP connection to your web server, and sends the JSON data there.
    • The web server starts up PHP and accepts the connection, and reads in the HTTP message.
    • You would parse the JSON and then load that data into your PHP Domain Object. You would want to do this so that you can validate your data in a structured manner. You don't want some yahoo injecting potentially harmful garbage into your database.
    • Then you'd use Doctrine to turn your Domain Object into SQL statements, saving it to the database.
    Also, if you are just starting out, I highly recommend PostgreSQL over MySQL, as it has more features and is more standards-compliant.

    As for a turnkey video, I am not sure, but I am sure that you can find them for the above parts.

    Good luck!

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar