mysql数据更新与插入保存
栏目:php教程时间:2014-02-28 23:42:16
- $hostname="localhost";
- $username="root";
- $password="";
- $link=mysql_connect($hostname,$username,$password);
- mysql_select_db("test",$link);
-
- $sql_str="update friends set name='andy' where id=1";
- mysql_query($sql_str) or die("出现错误!");
- echo mysql_info($link);
-
- $sql_str="insert into friends(name,sex,birthday,address)values('陈靖仇','男','593-08-23','天之痕')";
- mysql_query($sql_str) or die("出现错误!");
- printf("最后一次插入操作的id值为:%dn",mysql_insert_id());
------分隔线----------------------------
------分隔线----------------------------