新手上路,请问我错在哪儿?新手上路,请问我错在哪儿?
<?php require_once('../Connections/ips.php'); ?>
<?php
session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php require_once('session.php'); ?>
<?php
if($_POST['newsname']=="") {
echo "<script>alert('请输入信息名称!');location.href='ipsinfonew.php';<\/script>";
exit;
}
if($_POST['newsurl']=="") {
echo "<script>alert('请输入URL地址!');location.href='ipsinfonew.php';<\/script>";
exit;
}
if($_POST['news_fenlei']=="") {
echo "<script>alert('分类不能为空,如果您还没有设置分类,请先设置分类!');location.href='ipsinfonew.php';<\/script>";
exit;
}
if($_POST['newsname']=="") {
echo "<script>alert('请输入信息名称!');location.href='ipsinfonew.php';<\/script>";
exit;
}
$colname_news_info = "1";
if (isset($_POST['newsname'])) {
$colname_news_info = (get_magic_quotes_gpc()) ? $_POST['newsname'] : addslashes($_POST['newsname']);
}
mysql_select_db($database_ips, $ips);
$query_news_info = sprintf("SELECT * FROM ips_news WHERE newsname = '%s'", $colname_news_info);
$news_info = mysql_query($query_news_info, $ips) or die(mysql_error());
$row_news_info = mysql_fetch_assoc($news_info);
$totalRows_news_info = mysql_num_rows($news_info);
if($totalRows_news_info==1) {
echo "<script>alert('信息名称重复,请检查是否已有此信息!');location.href='ipsinfonew.php';<\/script>";
exit;
}
else {
$newsname=$_POST['newsname'];
$newsimg=$_POST['newsimg'];
$newsurl=$_POST['newsurl'];
$news_leixin=$_POST['news_leixin'];
$news_fenlei=$_POST['news_fenlei'];
$user=$_POST['user'];
$up=$_POST['up'];
$sql="INSERT INTO `cdtc7103`.`ips_news` (`id`, `newsname`, `newsimg`, `newsurl`, `news_leixin`, `news_fenlei`, `user`, `up`, `regdate`) VALUES (NULL, '$newsname', '$newsimg', '$newsurl', '$news_leixin', '$news_fenlei', '$user', '$up', NOW())";
$Result1 = mysql_query($sql, $ips) or die(mysql_error());
echo "操作成功";
echo " <a href="ipsinfonew.php">继续增加</a>";
exit;
}
?> ;
我在我的mysql里试过 sql 能正常反应
但还是打不开,出错
测试地址:http://www.cdtce.cn/ips/user/login.php
帐号:admin
密码:admin
请指点下我错在哪儿?