PHP 无限分类
<?php
//作者:梁文平 http://www.tyasp.net
session_start();
if($_SESSION["username"]!="admin")
{
echo("<mce:script type="text/javascript"><!--
alert("操作超时!请重新登陆...");window.location.href="../index.php";
// --></mce:script>");
//header("refresh:0;url=../");
exit();
}
include("../../include/include.php");
$simple=new simple_gb;
$simple->linkdb($host,$user,$password,$db);
if($_GET["action"]=="submit")
{
$result=mysql_query("select max(ClassId)+1 as aa from newsclass");
$row=mysql_fetch_array($result);
$sql="insert into newsclass (ClassId,ClassDesc,ParentId) values("". $row["aa"] ."","". $_POST["txtClassDesc"] ."","". $_POST["dropParentId"] ."")";
mysql_query($sql);
echo("提交成功!");
exit();
}
/*
$sql="insert into news (newstitle,content,savedate) values("a","b","". date("Y-m-d H:i:s") ."")";
mysql_query($sql,$simple->con);
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF8" />
<title></title>
</head>
<body>
<link href="../Admin_Style.css" mce_href="Admin_Style.css" rel="stylesheet" type="text/css" />
<form id="form1" name="form1" method="post" action="?action=submit">
<table width="427" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<td width="58">类别名:</td>
<td width="353"><label>
<input name="txtClassDesc" type="text" id="txtClassDesc" />
</label></td>
</tr>
<tr>
<td>父 类:</td>
<td><label>
<select name="dropParentId" id="dropParentId">
<option value="0">根目录</option>
<?php
$result=@mysql_query("sel
相关文档:
PHP是一个很优秀的工具,它可以简单,也可以复杂。不一样的项目,应该用不一样的PHP。
小项目 – 简单而直接的PHP
一般对于一个功能页面在20以下的网站,我们可以用一个很简单的框架结构来写。在这个规模上,我建议是使用比较直接的面向过程编码方法,原因很简 单,没有必要把class文件弄的N ......
in_array(value,array,type) //检查一个值是否在数组中,type可选,设置为true检查类型是否相同,分大小写
例:
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
......
感谢作者,文章来源
http://www.csask.com/blog/?p=108
eclipse是我非常喜欢的IDE,开源+免费+功能强大+跨平台+跨语言+插件机制,虽然有时候也会有这样那样的问题,但是作为主力开发IDE,eclipse已经非常足够了。
第1步,安装JRE:
sudo apt-get install sun-java6-jre
第2步,下载eclipse:
http://www.eclipse.or ......
在新安装好的mysql ,apahce,php 的时候,如果在代码中使用了sessions_start() 的时候会出现类似以下的错误:
Warning: session_start() [function.session-start]: Cannot send session cooki 等的错误。
请安装如下的思路去修正:
1.在php.ini 中配置 session.savepath='/tmp'
2.开启session.auto_start=1
3.把更改 ......
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 92160 bytes) in :\Inetpub\wwwroot04\test.php on line 8
Fatal error: Out of memory (allocated 259,260,416) (tried to allocate 16 bytes) in C:\Inetpub\wwwroot04\test.php on line 8
//ini_set('memory_limit', '-1');
$inde ......