代码如下 | 复制代码 |
代码如下 | 复制代码 | |||
|
把下面代码保存忝13.php
代码如下 | 复制代码 |
checkusername(); function checkusername() { $title = trim($_get['title']); if( empty( $title ) ) { return false; } else { mysql教程_connect('localhost','root','root'); mysql_select_db('test'); mysql_query("set names 'gb2312'"); $sql = "select * from cn_user where username ='$title'"; $row = mysql_query($sql); if( mysql_num_rows( $row ) ) { echo 1; } else { return null; } } } |
/*
create table `test`.`cn_user` (
`id` int not null auto_increment ,
`username` varchar( 20 ) not null ,
`times` date null ,
primary key ( `id` )
) engine = myisam
插入数据
insert into `test`.`cn_user` (
`id` ,
`username` ,
`times`
)
values (
null , 'jimmy', null
), (
null , 'www.111com.net', null
);
*/
?>