Home > Backend Development > PHP Tutorial > php一个表单怎么提交到两个数据库

php一个表单怎么提交到两个数据库

WBOY
Release: 2016-06-13 10:17:34
Original
1147 people have browsed it

php一个表单如何提交到两个数据库
一套社区系统整合了微博功能,社区和微博系统各有自己数据库,想把注册社区用户名信息也提交到微博用户表中,如何实现,学Php才几天。求高手解答!谢谢

------解决方案--------------------
$link1=mysql_connect("服务器地址1","用户名1","密码1");
mysql_select_db("数据库1",$link1);
mysql_query("insert into `表名1` values('','{$_POST[key]}')",$link1);

$link2=mysql_connect("服务器地址2","用户名2","密码2");
mysql_select_db("数据库2",$link2);
mysql_query("insert into `表名2` values('','{$_POST[key]}')",$link2);

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template