Uzyskaj zapytanie hrabia sql w php
$result=mysql_query("SELECT count(*) as total from Students");
$data=mysql_fetch_assoc($result);
echo $data['total'];
Ankur
$result=mysql_query("SELECT count(*) as total from Students");
$data=mysql_fetch_assoc($result);
echo $data['total'];
$q="select * from location where community='Zoo' AND status='1'";
$res=mysqli_query($con,$q);
echo mysqli_num_rows($res);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("host", "username", "password","db_name");
mysqli_set_charset($link, "utf8mb4");
$result = mysqli_query($link, "SELECT count(*) FROM blackandwhite");
$num_rows = mysqli_fetch_row($result)[0];
echo "$num_rows Rows\n";
mysqli_num_rows($result);
$sql = "SELECT COUNT(*) AS total from Members";
$result = $conn->query($sql);
$data = $result->fetch_assoc();
echo $data['total'];
<?php
$con = mysqli_connect("localhost","root","","test");
if (!$con)
{
die('Could not connect: ' . mysqli_error());
}
$result = mysqli_query("select COUNT(*) FROM table");
$row = mysqli_fetch_array($result);
$total = $row[0];
echo "Total rows: " . $total;
mysqli_close($con);
?>