How do you send data from sensor to database mit app inventor?

Hi, my first topic here.. i have sensor and ESP32 programmed to send data from sensor to mit app inventor, i want to send it from app to mysql base , my data is not inserted in mysql database.. i tried veryy much posibilities to do this. can you help?

define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', '');
define('DB_NAME', 'heart_rate_data');

// Establish the database connection
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (!$dbc) {
    die("DATABASE CONNECTION FAILED: " . mysqli_connect_error());

$dbs = mysqli_select_db($dbc, DB_NAME);
if (!$dbs) {
    die("DATABASE SELECTION FAILED: " . mysqli_error($dbc));

if (isset($_GET['bpm'])) {
    $bpm = mysqli_real_escape_string($dbc, $_GET['bpm']);
    $query = "INSERT INTO bpm_readings (bpm) VALUES ('$bpm')";

    if (mysqli_query($dbc, $query)) {
        echo "Records added successfully.";
    } else {
        echo "ERROR: Could not able to execute $query. " . mysqli_error($dbc);
} else {
    echo "No data received.";


What response do you get from your php file ?

In that envio procedure, make sure the blank text block is really a blank, and not completely empty. Click on it to edit inside, and see if you can wiggle the cursor back and forth. The blocks Editor likes to trim blanks in text blocks, and it's hard to tell the difference visually between space and empty.

I do not think, that the address will work... this is the same as localhost... use the correct ip address of your server... is the server available in the same local network as the Android device? Alternatively try a web host... see also App Inventor Tutorials and Examples: MySQL | Pura Vida Apps