今日课程:PHP 3天基础巩固视频教程【燕十八】php
一、apache安装和虚拟主机配置mysql
二、安装mysqlsql
3.mysql入门语句数据库
//连接数据库服务器 mysql -h localhost -u root -p //查看库 show detabases //选库 use 库名 //查看库下面的表 show tables //建表 cerate tables msg( id int auto_increment primary key, content varchar(200), pubtime int )charset utf8; //告诉服务区字符集 set names gbk/utf8; //添加数据 insert into msg(id,content,pubtime) balyes (1.'222',130123); //查询因此数据 select * form msg where id=2/1/1^ //快速清空表 truncate 代表
四、提交留言到MYSQLapache
//链接mysql $conn = mysql_connect('192.168.1.2','root','***'); //发送查询 mysql_query('use test',$conn); mysql_query('set names utf8',$conn); //接收post信息 #sql = "inset into liuyan(title,content,pubtime) values ('"$_POST['title']."','".$_POST['content']."',".time().");"" //echo #sql if(mysql_query($sql.$conn)){ echo "yes"; }else{ echo "no"; }