Open gfh31fgh2 opened 1 year ago
Hello @gfh31fgh2
There is no specific function in the library to do this, but it is possible to obtain it through the count
function
$db = $service->initializeDatabase('products', 'id');
try{
$listProducts = $db->fetchAll()->getResult(); //fetch all products
echo "Total: " . count($listProducts) . " rows on product table";
}
catch(Exception $e){
echo $e->getMessage();
}
Hello @gfh31fgh2
There is no specific function in the library to do this, but it is possible to obtain it through the
count
function$db = $service->initializeDatabase('products', 'id'); try{ $listProducts = $db->fetchAll()->getResult(); //fetch all products echo "Total: " . count($listProducts) . " rows on product table"; } catch(Exception $e){ echo $e->getMessage(); }
Thanks for answer! But for count > 100k, it isnt good function for this. Trying to use javascript on same instance for counting special requests like
const { data, count } = supabase
.from('countries')
.select('*', { count: 'exact', head: true })
Hello @gfh31fgh2 There is no specific function in the library to do this, but it is possible to obtain it through the
count
function$db = $service->initializeDatabase('products', 'id'); try{ $listProducts = $db->fetchAll()->getResult(); //fetch all products echo "Total: " . count($listProducts) . " rows on product table"; } catch(Exception $e){ echo $e->getMessage(); }
Thanks for answer! But for count > 100k, it isnt good function for this. Trying to use javascript on same instance for counting special requests like
const { data, count } = supabase .from('countries') .select('*', { count: 'exact', head: true })
Hi, I struggle same issue, but after read the discussion here, I found out that the count parameter and response was calculated in header of request & response.
What I do is :
I don't recommend to use GET request to do this because it will render the body section, but use HEAD instead more lighter
How to count records with this api?