php学习笔记(12):PHP+MYSQL留言板(上
require() 与 require_once()
通常放在 PHP 程序的最前面,PHP 程序在执行前,就会先读入 require
所指定引入的文件,如果出现错误是致命的。
nclude() 与 include_once()
可以放在 PHP 程序的任何一个位置,PHP 程序在执行到时,才会先读入
include 所指定引入的文件,如果出现错误将会提示。
require('con.php') ;
include('con.php') ;
PHP5在默认的情况下接收参数是需要使用
$_GET['value'];
$_POST['value'];
还可以在PHP.ini 文件中的
将register_globals = Off
改register_globals = on
可以直接使用,$value的值
con.php //数据库配置
add.php //操作文件
list.php //列表文件
俗话说:源码面前无秘密,下面我们来看源代码:
add.php:
<?php
/*
* Created on 2010-1-4
* Author:CHAVUET
* Function:留言板
*/
?>
<script type="text/javascript">
function ClearInputs(){
document.myform[0].value="";
document.myform[1].value="";
document.myform[2].value="请输入您的留言内容";
}
</script>
<form name="myform" action="conn.php" method="post">
<table align="center" style="margin-top:200px">
<tr>
<td>留言人:<input type="text" name="user" size="10"/></td>
</tr>
<tr>
<td>标 题:<input type="text" name="title" size="14"/></td>
</tr>
<tr>
<td>内 容:<textarea name="content">请输入您的留言内容</textarea></td>
</tr>
<tr>
<td><input type="submit" name
相关文档:
转帖请注明出处,并保持文章的完整性。
对MySQL数据库来说,同一时刻,在同一个连接(connection)上,只允许进行一个操作(query,etc.),如果你的程序是多线程的,并且你在多个线程中都会利用同一个connection对数据库进行操作,那么,就有可能发生问题。
例如,你可能会收到“Commands out of sync”的错误 ......
使用mysql时,通常表中会有一个自增的id字段,但当我们想将表中的数据清空重新添加数据时,希望id重新从1开始计数,用以下两种方法均可:
方法一:
alter table tablename drop column id;
alter table tablename add id mediumint(8) not null primary key auto_increment first;
方法二:
alter table tab ......
1.
Download Apache for windows MSI
file, and run it
By
default, port is 80, root dir is %apache_dir%/htdocs. You can update the
settings in conf/httpd.conf file
2. If Apache Service can't be installed in "Control Panel > Admin Tools > Services&quo ......
开始之前,首先要澄清两个问题:第一,支持开源,不等于反对代码加密;第二,如果把不属于自己的东西(比如公司的)拿去开源,就更加不应该了。
以前知道的,PHP代码的加密都是用Zend的encoder,这东西不但是商业软件,好像还暴出过能够被破解的问题,所以就找到了替代的方案────php_screw,一个日本人开发的东东。
p ......