PHP系统查询,修改,删除可实现。插入数据无法实现
session_start();include"../inc/chec.php";include"../conn/conn.php";include"../inc/fun...
session_start();
include "../inc/chec.php";
include "../conn/conn.php";
include "../inc/func.php";
$sqlstr = "insert into tb_person values('','".$_POST['p_title']."','".$_POST['p_content']."',now(),'".$_POST['p_type']."')";
$result = mysql_query($sqlstr,$conn);
re_message($result,"p_manage.php");
?>
<?php
if (!session_id()) session_start();
function w_log($act){
$filename = "./admin/log.txt";
$f_open = fopen($filename,"a+");
$str = $_SESSION['u_name'].",".date("Y-m-d H:i:s").",".$_SERVER['REMOTE_ADDR'].",".$act."\n";
fwrite($f_open,$str);
fclose($f_open);
}
function getGroup($conn,$uname,$ugroup){
$sqlstr = "select u_member from tb_group where id = ".$ugroup;
$result = mysql_query($sqlstr,$conn);
$rows = mysql_fetch_row($result);
$num = explode(",",$rows[0]);
$bool = false;
for($i = 0;$i < count($num);$i++){
if($uname == $num[$i])
$bool = true;
}
return $bool;
}
function get_tp($conn){
$sqlstr = "select f_type from tb_list group by f_type order by id";
$result = mysql_query($sqlstr,$conn);
return $result;
}
function read_field($conn,$tablename,$fieldname,$n_id){
$sqlstr = "select ".$fieldname." from ".$tablename." where id = ".$n_id;
$result = mysql_query($sqlstr,$conn);
$rows = mysql_fetch_row($result);
return $rows[0];
}
function re_message($result,$l_address){
if($result)
echo "<script>alert('操作成功!');location='".$l_address."';</script>";
else
echo "<script>alert('系统繁忙,请稍后再试');history.go(-1);</script>";
}
?>
然后就是输入信息后跳转出提示:系统繁忙,请稍后再试。而且数据库中没有信息的录入。 展开
include "../inc/chec.php";
include "../conn/conn.php";
include "../inc/func.php";
$sqlstr = "insert into tb_person values('','".$_POST['p_title']."','".$_POST['p_content']."',now(),'".$_POST['p_type']."')";
$result = mysql_query($sqlstr,$conn);
re_message($result,"p_manage.php");
?>
<?php
if (!session_id()) session_start();
function w_log($act){
$filename = "./admin/log.txt";
$f_open = fopen($filename,"a+");
$str = $_SESSION['u_name'].",".date("Y-m-d H:i:s").",".$_SERVER['REMOTE_ADDR'].",".$act."\n";
fwrite($f_open,$str);
fclose($f_open);
}
function getGroup($conn,$uname,$ugroup){
$sqlstr = "select u_member from tb_group where id = ".$ugroup;
$result = mysql_query($sqlstr,$conn);
$rows = mysql_fetch_row($result);
$num = explode(",",$rows[0]);
$bool = false;
for($i = 0;$i < count($num);$i++){
if($uname == $num[$i])
$bool = true;
}
return $bool;
}
function get_tp($conn){
$sqlstr = "select f_type from tb_list group by f_type order by id";
$result = mysql_query($sqlstr,$conn);
return $result;
}
function read_field($conn,$tablename,$fieldname,$n_id){
$sqlstr = "select ".$fieldname." from ".$tablename." where id = ".$n_id;
$result = mysql_query($sqlstr,$conn);
$rows = mysql_fetch_row($result);
return $rows[0];
}
function re_message($result,$l_address){
if($result)
echo "<script>alert('操作成功!');location='".$l_address."';</script>";
else
echo "<script>alert('系统繁忙,请稍后再试');history.go(-1);</script>";
}
?>
然后就是输入信息后跳转出提示:系统繁忙,请稍后再试。而且数据库中没有信息的录入。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询