Use this query
“select * from table_name order by rand() limit 1 “
Filed under: Php, mysql | Tagged: mysql, Php, random query | Leave a Comment »
Use this query
“select * from table_name order by rand() limit 1 “
Filed under: Php, mysql | Tagged: mysql, Php, random query | Leave a Comment »
<?php
require_once(“conf.php”); // youe database connection file
$result = mysql_query( “SHOW TABLE STATUS” );
$dbsize = 0;
while( $row = mysql_fetch_array( $result ) ) {
$dbsize += $row[ "Data_length" ] + $row[ "Index_length" ];
}
?>
<?php
echo “<p>The size of the database is ” . formatfilesize( $dbsize ) . “</p>”;
?>
Filed under: Php | Tagged: databse size, get database size, mysql, Php | Leave a Comment »
To avoid the cross side scripting or make site safe from hacker attacks one need to perform data validation before allowed data insertion into database . We can achieve this using php preg_match which check data format to see whether it is in valid state or not. The following code snippet is standard validation example
function [...]
Filed under: Php | Tagged: hackersafe, Php, preg_match | Leave a Comment »