Home » Php » mysql – php using a variable in dynamic api call

mysql – php using a variable in dynamic api call

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am having a weird issue dynamically using a value as a filter in an API call. So first I get a datetime from my database, I then use this in a filter condition on a API call. What is weird is this works when I get just an id (with no comparison operator). Using the date time it is like there was no filtering at all. The 3rd party needs the variable to be used like below. I think this has something to do with runtime but I am not sure. Any useful comments will be greatly appreciated. I am open to different ways to get a date time filter to work.

$reduceload = "SELECT timestamp FROM item ORDER BY timestamp DESC LIMIT 1";
$loadresult = mysqli_query($con, $reduceload);

while($rows = $loadresult->fetch_assoc()) 
{
   $lastcount = $rows['timestamp'];
}


$myvar = "'timestamp > \"$lastcount\"'";


$result = api::get($myvar,null,null); 
How to&Answers: