In this topic you will learn how to integrate with Node.js using MYSQL database management tool. You will learn various ways to connect and interact with data residing in mysql using a nodejs program and script.
mysqli interface is an improvement (it means "MySQL Improvement extension") of the
mysql interface, which was deprecated in version 5.5 and is removed in version 7.0.
The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.
This script is designed to handle reporting devices (IoT), when a device is not previously authorized (in the devices table in the database), I add the new device to a new_devices table. I run an update query, and if affected_rows returns < 1, I insert.
When I have a new device report, the first time $stmt->affected_rows runs it returns 0, subsequent communication returns 1, then 1, 0, 2, 2, 2, 0, 3, 3, 3, 3, 3, 3, 0, 4, 0, 0, 6, 6, 6, etc
It's as if the update statement is failing. Why?