限制1-10不能放11,12,13,14,15等
<input type="text" onkeypress='return event.charCode >= 2 && event.charCode <= 57'></input>
答案 0 :(得分:0)
计算数据库中的行数。如果您使用的是MYSQL数据库,则可以使用此代码:
<?php
db_connect();//class connection to the database
//query the database and count
$sql = "select * from tablename";
$res = mysqli_query($sql);
$num_rows = mysqli_num_rows($res);
//display the result
echo $num_rows;
?>
答案 1 :(得分:0)
计算mysql行结果你可以使用mysqli_num_rows($query)
例如:
<?php
$query = mysqli_query($db, "SELECT * FROM users WHERE active = 1");
$active_users = mysqli_num_rows($query);
echo $active_users . 'Are activated on your site';
?>