php string length
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
php string length
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
php num rows
<?php
/*
Explination
The mysqli_num_rows() function is an inbuilt function in PHP
which is used to return the number of rows present in the result set.
It is generally used to check if data is present in the database or not.
To use this function, it is mandatory to first set up the connection with the MySQL database.
*/
// Setting up connection with database Geeks
$con = mysqli_connect("localhost", "root", "", "testing");
// Check connection
if (mysqli_connect_errno()) {
echo "Database connection failed.";
}
// Fetch Query
$query = "SELECT Username, Password FROM users";
// Execute the query and store the result set
$result = mysqli_query($con, $query);
if ($result) {
// it return number of rows in the table.
$row = mysqli_num_rows($result);
if ($row) {
printf("Number of row in the table : " . $row);
}
// close the result.
mysqli_free_result($result);
}
// Output : Number of row in the table : 5
?>
mysql rowcount php
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);
$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows Zeilen\n";
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us