php教程:mysql的常用语句
关于 PHP 教程的文章已经很多了,今天给大家介绍几个常用的MYSQL语句。
显示数据库或表:
show databases;//然后可以use database_name;
show tables;
更改表名:
alter table table_name rename new_t;
添加列 :
alter table table_name add column c_n column attributes;
删除列:
alter table table_name drop column c_n;
创建索引:
alter table c_table add index (c_n1,c_n2);
alter table c_table add unique index_name(c_n);
alter table c_table add primary key(sid);
删除索引:
alter table c_table drop index c_n1;
更改列信息:
alter table t_table change c_1 c_1 varchar(200);
alter table t_table modify 1 c_1 varchar(200);
insert插入语句:
insert into table_name (c_1,c_2)
values ('x1',1);
update语句:
update table_name set c_1 =1 where c_2=3;
删除数据库或者表:
drop table table_name;
drop database database_name;//使用mysql_drop_db()可以删除的.
相关文档:
晚上特意花了个时间,自己动手试了下。
在项目中一直碰到Cookie跨域访问及SessionId跨域传递问题
范例:
index.php
<?php
include_once('a.php');
session_start();
$_SESSION['k'] = uniqid();
setcookie("sess", session_id(), time()+3600, "/", ".ipggg.com");
echo "index.php<br />\n";
echo $ ......
最近两天项目需要,由于服务器正在开发,客户端进度稍快一些,没有服务器进行联调。因此我重操旧业,用PHP快速的写了一些web页面,算是当测试桩程序了,七八个web接口,基本上5到6个小时搞定了。由于当前的服务器需要与其他服务器进行对接,因此写的这个web服务还需要充当client角色,向其他服务器发送请求。
在网上搜了一 ......
前几天在学习PHP的时候做了一个简单的数据增删改的程序,由于自己是第一次接触PHP所以在许多地方做的不到位,感觉很牵强,但是毕竟是花了时间的,所以现在贴出来。
1.完成增删查改的主页面:connsql.php
<h1>Data Insert Delete Update</h1>
<?php
//获得数据库连接
& ......
今天废了一天的时间来从新把环境搭建好:做个笔记
安装顺序:
apache->php->mysql
一些注意的地方记下来吧:
1. apache 支持 php
apache 配置文件下:需要修改的地方:
i. PHPIniDir "F:/programs/php/"
&n ......