This is related, but not directly to B4X I have this working (amazingly all by myself) and its fixed a few bugs i had, (eg, some data in the table was returned as null or just crashed the app, (i think the data contained puctuation)) however, its working fine now!
Now the PHP, is my problem when I had 10+ PHP files (one for each map) I set the mainname to return in date order (latest first) so in my app the newest files where shown first! however this is no longer the case (i think due to the simplicity of the PHP)
Also my last updated, was a (google found) PHP that returned results like 5 mins ago, 1 week ago, but now its just showing the timestamp (as expected)
Obviously this is the B4X forum, NOT the PHP forum, but im wondering if anyone could give me hints on how I can get the result im looking for?? if not just ignore me!
Spoiler: My PHP
<?php //open connection to mysql db $connection = mysqli_connect("localhost","XXXXXXXXX","XXXXXXXXXXXX","XXXXXXXXXXX") or die("Error " . mysqli_error($connection));
//fetch table rows from mysql db
$sql = "select * from BuildData";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
//create an array
$emparray = array();
while($row =mysqli_fetch_assoc($result))
{
$emparray[] = $row;
}
echo json_encode($emparray);
//close the db connection
mysqli_close($connection);
So the question how would i sort the output by a field called Updated?
An B) the updated field returns a timestamp, But I have php to make it fuzzy like (ten minutes ago, 1 Week ago)
with question b)
I could still use the PHP, but dont want to as thats the whole point of the main post!
maybe i could integrate that php into this to get the desired result?
maybe there is some code that i can change the timestamp to fuzzy in B4X??
Thanks!
Aidy