程序如下
$a=$database->DataQuery("Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ('$Ipt_Number','$Ipt_Title','S')");
echo "Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ('$Ipt_Number','$Ipt_Title','S')<br>";
if($a)
{
echo "添加成功";
}
else
{
echo "添加失败";
}
输出为:
Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ('04','dsaf','S')
添加成功 但是数据并没有加入到数据库中,请问下是什么原因啊
如果直接在$Ipt_Number这个变量这里直接使用“04”的值,就能添加到数据库中
$a=$database->DataQuery("Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ('$Ipt_Number','$Ipt_Title','S')");
echo "Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ('$Ipt_Number','$Ipt_Title','S')<br>";
if($a)
{
echo "添加成功";
}
else
{
echo "添加失败";
}
输出为:
Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ('04','dsaf','S')
添加成功 但是数据并没有加入到数据库中,请问下是什么原因啊
如果直接在$Ipt_Number这个变量这里直接使用“04”的值,就能添加到数据库中
解决方案 »
- 关于翻页的问题
- 谁可以帮助小妹啊
- zend form label中文不显示
- 谁能帮我解析一下(1)对象(2)类(3)对象之间的关系这三个是什么意思
- htaccess问题
- phpMyAdmin - 2.9.0.2 编码问题请教
- 请教高手,关于ioncube的具体用法
- 如何在一个页面内定位指定的查询记录项?怎样才能获得它是第几个记录?
- 哪里买的空间比较好?有兄弟买过cxc.cc的空间吗?
- php中有没有读取系统目录(象c:\windows;c:\winnt)的函数?急!急!急!
- NetBeans 开发php时,对于网页有没有类似dreamweaver那样的设计视图
- php导出excel遇到些小问题
$a=$database->DataQuery("Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ({$Ipt_Number},'$Ipt_Title','S')");
这样
这3个字段在数据库中全是varchar
代码改为:
$a=$database->DataQuery("Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ($Ipt_Number,'$Ipt_Title','S')");
echo "Insert Into ks_rolerightstype (Number,Title,Smod) VALUES ($Ipt_Number,'$Ipt_Title','S')<br>";
if($a)
{
echo "添加成功";
}
else
{
echo "添加失败";
}
{
$result = @mysql_query($query_str);
return $result;
}
但是 觉得SQL 编码规范 你如果大写就全部大写 如果小写就全部小写 但是你这样混写 我很纠结!
function DataQuery($query_str)
{
$result = @mysql_query($query_str);
$id = mysql_insert_id();
return $id;
}
有插入的话 $id 就不为0的
而不是用$result来进行判断这只是针对你的这个insert语句而已,看看是你的那里出了问题