生手提问。直接看吧。

WBOY
Release: 2016-06-13 10:52:10
Original
1068 people have browsed it

新手提问。。。直接看吧。。。
我是把有mysql的代码独立在in.php页面,in.php代码如下:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php date_default_timezone_set('PRC');    $sj = date("Y-m-d H:i:s");        $sql = mysql_connect("127.0.0.1","root","kingmo");    mysql_query('$sql');    if (!$sql){        die('数据连接失败,原因:'.mysql_error());    }        mysql_select_db("yang",$sql);        $a_os = mysql_query("SELECT os FROM os");    if (!$a_os){        die('数据查询失败,原因:'.mysql_error());    }    $os = mysql_fetch_array($a_os);        if($go==1)    mysql_select_db("yang",$sql);    $a_lr = "SELECT xinxi FROM name, old, add, pj";    mysql_query($a_lr,$sql);    $lr = "INSERT INTO Persons (name, old, add, pj)     VALUES    ('$_POST[name]','$_POST[old]','$_POST[add]','$_POST[pj]')";        if (!mysql_query($lr,$sql)){        die ('发生错误了囧,代码:'.mysql_error());    }    echo "录入成功拉!!!";    mysql_close($sql);    ?>
Copy after login


现在要实现的是录入信息并保存到数据库,那么luru.php的代码是这样。
PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><meta http-equiv="Content-Type" content="text/html; charset=GBK">
Copy after login
濮撳悕锛
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!