<?php //连接数据库 mysql_connect('127.0.0.1', 'code1', ''); mysql_select_db('code1'); mysql_query("set names 'utf8'"); //已知的数据变量有 $name = '李四'; $age = 18; $class = '高三一班'; //在这里进行数据查询 $sql = "insert into user(name, age, class) values('$name', '$age', '$class')"; mysql_query($sql); //执行插入语句 $uid = mysql_insert_id(); echo $uid;
快结束了!