42 thoughts on “Tutorial 2 – Insert Data Into Database Using AngularJS

    Prakhar Mishra

    (March 13, 2018 - 1:29 pm)

    If possible do it with laravel as a back end. Thank you

    Eric Wilfried Ettien

    (March 13, 2018 - 1:29 pm)

    Thank you !

    Jaya Bharath

    (March 13, 2018 - 1:29 pm)

    not working with my url

    manoj kumar

    (March 13, 2018 - 1:29 pm)

    in real time projects how would be sending values … to server any example ..give me any link to study. for real time company project type

    rose merah

    (March 13, 2018 - 1:29 pm)

    why when i click submit button, dont have any response???please help me

    조커

    (March 13, 2018 - 1:29 pm)

    Very cooooool awesome tutorial
    I would like to learn more about the Delete, Update tutorial !!! : )

    Pradnya S

    (March 13, 2018 - 1:29 pm)

    Nice Video…..I also implemented the same ..i got a success msg in console too..but the values arent uploaded in db..i don't know where i am wrong…?…plz help me..below is my code

    .html file

    <!doctype html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    </head>
    <body>
    <div ng-app="myapp" ng-controller="empcontroller">
    <form>
    Name: <input type="text" ng-model="name" placeholder="name"/>
    Dept: <input type="text" ng-model="dept" placeholder="dept"/>
    <input type="button" ng-click="insertdata()" value="Submit"/>
    </form>
    </div>

    <script>
    var app = angular.module("myapp",[]);
    app.controller('empcontroller',function($scope,$http){
    $scope.insertdata = function(){
    $http.post("insert.php",{'name':$scope.name,'dept':$scope.dept}).success(function(data,status,headers,config){
    console.log("inserted");
    });
    }
    });
    </script>
    </body>
    </html>

    inset.php

    <?php
    $data = json_decode(file_get_contents("php://input"));
    $name = mysql_real_escape_string($data->name);
    $dept = mysql_real_escape_string($data->dept);
    mysql_connect("localhost","root","");
    mysql_select_db("cucch_19430821_company");
    mysql_query("insert into emp('name','dept') values('".$name."','".$dept."')");
    ?>

    Md Nasim

    (March 13, 2018 - 1:29 pm)

    Thank you so much, very interesting tutorial… Very well from another tutorial

    Revaz Eristavi

    (March 13, 2018 - 1:29 pm)

    Thanks, very good presentation.

    Andrew Larsen

    (March 13, 2018 - 1:29 pm)

    Excellent work! Thank you so much!

    Baptiste Dumortier

    (March 13, 2018 - 1:29 pm)

    Ty u a lot, it was very helpfull for my student dev project 🙂

    rtql8d

    (March 13, 2018 - 1:29 pm)

    Fantastic tutorial! Worked like a charm, thank you.

    rosaline kusuma

    (March 13, 2018 - 1:29 pm)

    thank you very much…

    Joseph Aspey

    (March 13, 2018 - 1:29 pm)

    Simple yet effective, nice one bro.

    Chrollo Lucilfer

    (March 13, 2018 - 1:29 pm)

    This is awesome, thank you bro 😉

    Israel Meshileya

    (March 13, 2018 - 1:29 pm)

    ..pls, i am having Uncaught error, after using this tutorial on my chrome browser

    Vitaly

    (March 13, 2018 - 1:29 pm)

    your tutorial is very good for beginers.. all clear

    chetan kothari

    (March 13, 2018 - 1:29 pm)

    Good!!!

    Badr Ouali Alamo

    (March 13, 2018 - 1:29 pm)

    i have a this error : index.html:1 XMLHttpRequest cannot load http://localhost/insert.php. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. i need a help pleaaase

    Nisal Malinda Livera

    (March 13, 2018 - 1:29 pm)

    hello!! this code doesn't work for me!! when i see the errors in the console it says…

    SyntaxError: missing ) in parenthetical
    Error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=myapp&p1...

    but my code and yours is the same!! If you have the source files with you, can you please send them to me?

    蔡新宇

    (March 13, 2018 - 1:29 pm)

    thanks for your video,i very like it.but may i ask you a question,if i use java servlet for back-end,does this code still avaliavle?

    Upender Sanga

    (March 13, 2018 - 1:29 pm)

    Hello, i just started with Angular js,
    But am not familiar with database, and i am trying to do this task but not working for me.

    Can you please share this code for me..

    Robert Muthomi

    (March 13, 2018 - 1:29 pm)

    hello i am a starter in angular and i really love the video,thanks a lot,i really needed code for retrieving data from a mysql database using angularJs too,please help

    Archemi

    (March 13, 2018 - 1:29 pm)

    thank you

    Volodymyr Aitubaiev

    (March 13, 2018 - 1:29 pm)

    thanks

    Parkash sharma

    (March 13, 2018 - 1:29 pm)

    I also implemented the same ..!!
    i got a success msg in console too..!!
    but the values arent uploaded in database..
    any suggestions where i am wrong…??
    any system error

    Pugazhenthi T

    (March 13, 2018 - 1:29 pm)

    It is simple and awesome. Thanks..

    Gonzalo Caminos

    (March 13, 2018 - 1:29 pm)

    Esta super cool tu video. La duda que tengo es la siguiente. Si quisiera trabajar con un motor de base de datos que sea no sql ¿sería muy distinto el asunto?

    Kris K

    (March 13, 2018 - 1:29 pm)

    very simple to understand. thanks for sharing

    Emmanuel Essandah

    (March 13, 2018 - 1:29 pm)

    I just started watching this guy's videos and it is amazing that he answers everybody's questions fast and promptly. I don't need anything right now but if I needed anything I know I won't be disappointed. It is called 'great customer service'. I just wanted to say Thanks for this share…

    Hernan Fleitas

    (March 13, 2018 - 1:29 pm)

    Excelente Aporte, simplificado y directo..

    Suhas C

    (March 13, 2018 - 1:29 pm)

    So Excellent !!.. Really Nice

    anil kumar

    (March 13, 2018 - 1:29 pm)

    hey programmer,
    i used ur code code but i am not able to save data..kindly help

    thanks

    Gustavo Espinosa

    (March 13, 2018 - 1:29 pm)

    Gracias por el ejemplo, se entiende bien. Saludos!

    Taylor Johnson

    (March 13, 2018 - 1:29 pm)

    Works for me. The problems I had were I needed to not put my table column names in single quotes, and I needed to make sure the 'myapp' div was wrapping the rest of the code. Thanks for this tutorial! 😀

    Mohammed Ak

    (March 13, 2018 - 1:29 pm)

    thank you dude for this video and using json instead of application/x-www-form-urlencoded is better

    Syedhassan Nadeem

    (March 13, 2018 - 1:29 pm)

    please uploaded all crud opeartion

    Devang Champaneria

    (March 13, 2018 - 1:29 pm)

    no audio

    Vikas Rana

    (March 13, 2018 - 1:29 pm)

    thanx for sharing ,i have done this .really thanx.

    Vikas Rana

    (March 13, 2018 - 1:29 pm)

    id are going to database but other filed are not inserting

    ashok chavada

    (March 13, 2018 - 1:29 pm)

    not working

    Julio Cesar Montenegro

    (March 13, 2018 - 1:29 pm)

    more easy with active record

Leave a Reply

Your email address will not be published. Required fields are marked *