Profile with saved information

@MUHAMMAD_ZIKRI_BIN_Y

Then your approach: XAMPP/mySQL, will require a different method to using CRUD for Google Sheets.

You might look here for salvation:

image
image

can you help me with this ? how do i past the value (username) from mit app inventor to the sql and then the sql will will return "content", "notesid", and "date" that only associated with the username that just been pass from mit

this is my sql:

<?php

include "connect.php"; // Database connection

// Retrieve and sanitize the username from POST request

$username = mysqli_real_escape_string($conn, $_POST['username']);

// SQL query to select notes for the given username

$data = mysqli_query($conn, "SELECT notesid, content, date FROM NOTES WHERE username='$username'");

if (!$data) {

die("Error in SQL query: " . mysqli_error($conn));

}

$results = array();

while ($row = mysqli_fetch_assoc($data)) {

$results[] = $row;

}

// Return the results as JSON

header('Content-Type: application/json');

echo json_encode($results);

// Close the database connection

mysqli_close($conn);

?>

Show some example records in your mysql

Remove the Get method

and show us the response content

Taifun

Select list item: Attempt to get item number 2 of a list of length 1: [["error", "No records found"]]
Note: You will not see another error reported for 5 seconds.

how do i fix this error, i still confuse with how index work in mit. this is my blockcode
image
image

and these are blockcode from listview page:

display for listviewpage;

display for listview(afterclick)page

this is my sql code:

<?php include "connect.php"; // Database connection $title = @$_POST['title']; //$title = "SELASA"; // Use prepared statements to avoid SQL injection and syntax errors $stmt = $conn->prepare("SELECT * FROM NOTES WHERE title = ?"); $stmt->bind_param("s", $title); $stmt->execute(); $res = $stmt->get_result(); // Initialize an empty array to hold the results $json = []; // Fetch the results and check if there are any rows if ($res->num_rows > 0) { while ($r = $res->fetch_array(MYSQLI_ASSOC)) { $json[] = $r; } } else { // Handle the case where no records are found $json = ["error" => "No records found"]; } echo json_encode($json, JSON_UNESCAPED_UNICODE); // Free the result and close the connection $stmt->free_result(); $stmt->close(); $conn->close(); ?>

Unfortunately you did not provide the raw response content...
My guess is, ypur php script is returning this

from your php code

// Handle the case where no records are found $json = ["error" => "No records found"];

what is the value of nametxt?
is it any reasonable notesid value?

let me suggest you to use a working solution

and if you got that running, adjust it to your needs

unknown

and using virtual screens would make your life much easier, see tip 1 here General Tips and Tricks for App Inventor

Taifun

1 Like