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
相关文档:
1、php与mysql建立连接
php.ini 加载mysql组件
extension=php_mysql.dll前的;去掉
exetension_dir=""路径是否正确
Php连接mysql函数
mysql_connect:开启MYSQL连接
mysql_select_dir:打开一个数据库
@和or die 隐藏错误和条件显示
mysql_connect("主机","用户名","密码");
mysql_sele ......
Jpgraph下载之后,安装非常简单,解压到一个文件夹中,例如:d:\Jpgraph,然后打开php的安装目录,找到php.ini文件,并修改其中的inlude_path参数,并在其后加上Jpgraph的路径,例如:inlude_path=".;d:\Jpgraph".
http://blog.csdn.net/zhuzhao/archive/2009/05/12/4174684.aspx ......
一直习惯使用小写的SQL保留字,没想到今天居然遇到了麻烦哈!!和谐一下MYSQL啦!
环境:Server version: 5.1.37-1ubuntu5 (Ubuntu)
alter table child_table_name
add constraint constraint_name
foreign key (column_1)
references reference_table_name(reference_column_1);
和
ALTER TABLE child_t ......
Memcached Functions for MYSQL官方主页:
https://launchpad.net/memcached-udfs
两篇基本文章:
http://www.libing.name/2009/02/06/mysql-map-data-to-memcached.html
http://www.libing.name/2008/02/26/mysql-map-memcached.html
安装和验证的SQL语句:
http://hg.tangent.org/memcached_functions_mysql/file/7 ......
使用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 ......