Please let me know if I do go off topic as it is important to stay on topic for others help if needed.
I was thinking to not change the script to help with listview as I do not know where to start with script change even.
I was thinking to keep your recommendation on the login system but add a tag textbox for the listview and use the tag to safe my listview info in CloudDB.
Do you think this will work, seeing cloudDB gets store on mit server?
Example: username and password will be connected to a tag to retain the listview info.
I have a google sheet with team names and images of the teams on which I converted to a listview. (I have teams on google sheet because it is easier to change info or update info of the team on google sheet and then app will atomically update in a second or two)
User will select a team or teams from the Team listview and this team will go into their profiles listview.
This is why I want to store the listview info of the user and retain it when they logged in.
I have try to convert listview to textbox and store the textbox to google sheet but then to reverse back into listview makes things hard because there is no set number of teams in each user profile. (Listview will be showing Image and text)
Due to the blocks of the login system only display one column and i need username and password, I have made username a selection option and then used password textbox matching password textbox for the app to confirm it is correct user.
However, it will be ideal to not have a user selection option and instead to have a user textbox and login button.
I have noticed the problem was on my side.
Because the login usernames all goes to a lsitview from googlesheet and works on selection option only, I needed to do something so the listview gets atomically selected.
I made the google sheet to search username and put the user details at the top on the listview.
All of this did not work..
Still need a login system with password where I can load users details and update as needed.
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);
?>
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
<?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();
?>