<?php
$res = mysql_query('SELECT COUNT(*) AS count FROM mytable');
$row = mysql_fetch_assoc($res);
$rows_count = $row['count']; // to get the count of rows in your table, then:
$r = mysql_query('SELECT * FROM mytable LIMIT '.mt_rand(1, $rows_count).', 1');
?>
The below function can strip almost all tags from a string. function strip_all_tags($string) { $string = preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $string ); $string = strip_tags($string); return trim($string); } $a = '<script type="text/javascript" src="jquery.js"></script> <div id="test" style="padding:5px; color:red;">Hello world</div>'; echo strip_all_tags($a); // outputs: Hello world
Comments
Post a Comment