Это видео недоступно.
Сожалеем об этом.

Node JS Tutorial | Insert Form Data into MySQL Table

Поделиться
HTML-код
  • Опубликовано: 21 апр 2022
  • Learn How to Insert Form Data into MySQL Database in Node JS Express CRUD Application. So in this Tutorial you will be learn How to Insert or Add or Save data into MySQL Table in Node.js Express. In this Node JS Video tutorial, we have step by step show you how to add data into MySQL Table with Node JS. So if you are looking for tutorial on Store Form Data in MySQL using Node JS then this tutorial will help you because in in this tutorial we have discuss how to insert data into MySQL Database in Node.js using Express framework.
    For Source Code - www.webslesson...

Комментарии • 23

  • @adaptivetechnologies7584
    @adaptivetechnologies7584 Год назад +1

    Hello Weblessons, first of all thank you very much for this very good tutorial. Few people are finding issues and same can be fixed as below:
    1. variables are not called in the query. Please use another method as below. I have different data, so you can adjust your variables accordingly:
    router.post("/add_sample_data", function (request, response, next) {
    var username = request.body.username;
    var password = request.body.password;
    var query = ' INSERT INTO users (username, password) VALUES(?, ?)';
    database.query(query, [username, password], function (error, data) {
    if (error) {
    throw error;
    }
    else {
    response.redirect("/sample_data");
    }
    })
    })

  • @gabehockin2991
    @gabehockin2991 2 года назад

    thank you very much, explained very clearly.
    can finally finish my school project.

  • @betelhemyemane2564
    @betelhemyemane2564 9 месяцев назад

    after so many struggle, also trying to read each of the same issues posted on stackoverflow, i finally got the answer why my data isnt being inserted int the mysql database table and that i am not being redirected to the file specified. the solution is i mistakingly wrote the type of the sublmit button to be button but the type of the button must be "submit". and i also added these 2 lines of codes:
    router.use(express.json());
    router.use(express.urlencoded({ extended: true }));

    • @betelhemyemane2564
      @betelhemyemane2564 9 месяцев назад

      since one of the datas which is "age" has a number data type and not string, i removed the quotation marks for: ${age}. notice that i didnt wrap ${age} with quotations because age has a number data type and does not need to go inside quotations.

  • @bohdankozatskyi521
    @bohdankozatskyi521 Год назад

    Author explain great need information about database plus Node and show how connected database+post_form+Node among ourselves

  • @AsadAli-wi1xs
    @AsadAli-wi1xs 2 года назад +1

    Nice Video Sir

  • @getsetalk
    @getsetalk 2 года назад

    Wow, awesome 😊

  • @bhattaraitheaxe
    @bhattaraitheaxe 2 года назад

    Thank you ❤️

  • @lukasgustafsson8476
    @lukasgustafsson8476 Год назад

    I get a "Cannot read properties of undefined (reading 'first_name')" error when trying to add data. Has anyone else encountered this problem and has a solution?

    • @amar_upd
      @amar_upd Год назад

      i am getting the same error... do you have the solution

    • @lukasgustafsson8476
      @lukasgustafsson8476 Год назад +1

      @@amar_upd You need to add a bodyparser function in the sample_data.js like this:
      var bodyParser = require('body-parser');
      router.use(bodyParser.json());
      router.use(bodyParser.urlencoded({ extended: true }));

    • @kasperlarsen9477
      @kasperlarsen9477 Год назад

      @@lukasgustafsson8476 where do you insert this? also having this issue

  • @subrotomukherjee8571
    @subrotomukherjee8571 2 года назад +2

    Can you explain how to solve the error in 10:53

    • @Fahrirmd
      @Fahrirmd Год назад

      I have the same problem here. In the video, the author just edited the next frame into the "actual" result. Author, please address this error.

    • @betelhemyemane2564
      @betelhemyemane2564 9 месяцев назад

      make sure the input button's type is submit.@@Fahrirmd

  • @bossman4112
    @bossman4112 Год назад

    i am getting an error which is action is undefined any ideas on this.
    The error happens in the ejs file

    • @amar_upd
      @amar_upd Год назад

      i am getting this error how to handle.. do u have the solution

    • @bossman4112
      @bossman4112 Год назад

      @@amar_upd could you elaborate more?

    • @betelhemyemane2564
      @betelhemyemane2564 9 месяцев назад

      in productjs there is this: router.get("/add", function(request, response, next){
      response.render("product_data", {title:'Add Product', action:'add'});
      });
      and inside the ejs file there is this:

  • @parkvince5399
    @parkvince5399 Год назад

    the music is disturbing