Maybe you’ve arrived here looking for a quick leg up.
If you’re just after a way to get up and running with My SQL in Node in as little time as possible, we’ve got you covered!
So I am creating a form to have a date entered from a user along with some text for another field in the database.
Basically it's a database that will record a date and specials for a bakery/deli.
format($my_date, 'Y-m-d h:i:s'); //formats date into my SQL Datetime field format // field "the_date" should be a datetime field $sql = "insert into table (the_date) values ('$formatted_date')"; mysql_query($sql, $conn); //execute the sql to create the record; could also use mysqli ?
But you shouldn’t architect your next project based on what’s hip and trendy.
If this is not the case, then check out this Site Point article to find out how to do that: Install Multiple Versions of using nvm.
After that, we’re installing the mysql module from npm and saving it as a project dependency.
Once the connection is successfully established you should be able to see the ‘Connection established’ message in the console.
If something goes wrong (for example you enter the wrong password), a callback is fired, which is passed an instance of the Java Script Error object ( by hand every time we make a change to our code is going to get a bit tedious, so let’s automate that.
Project dependencies (as opposed to dev-dependencies) are those packages required for the application to run.