php 操作mysql插入数据

diashuoshuo 2013-05-21 09:51:38
1、table_arr【】里保存的是html代码。用来在网页上显示表格。
2、数据库中保存table_arr【】里的代码段的字段用的是text类型。
我的问题在于,多一个保存$table_arr[]内容,如outstanding_thesis_tab,就无法执行插入操作。否则可以。我想知道这问题出在哪里。

$first_step="insert into lw_process(process_stu_num,dic_id,t_stu_select_title,p_stu_select_title,t_ter_select_stu,p_ter_select_stu,t_stu_select_ter,p_stu_select_ter,t_open_title,p_open_title,t_sub_original_ver,p_sub_original_ver,t_mid_check,p_mid_check,t_sub_final_ver,p_sub_final_ver,t_input_score,p_input_score,now_statue,final_statue,author_promise_tab,ter_promise_tab,open_title_tab,mid_check_stu_tab,mid_check_ter_tab,tutor_score_tab,review_score_tab,reply_score_tab,complex_score_tab,reply_record_tab,outstanding_thesis_tab) values(".$_POST['user_num'].",".$_POST['dic_id'].",'".$time_arr['t_stu_select_title']."',0,'".$time_arr['t_ter_select_stu']."',0,'".$time_arr['t_stu_select_ter']."',0,'".$time_arr['t_open_title']."',0,'".$time_arr['t_sub_original_ver']."',0,'".$time_arr['t_mid_check']."',0,'".$time_arr['t_sub_final_ver']."',0,'".$time_arr['t_input_score']."',0,0,0,'".$table_arr['作者承诺保证书']."','".$table_arr['教师承诺保证书']."','".$table_arr['开题报告表']."','".$table_arr['中期检查情况表']."','".$table_arr['中期检查教师检查表']."','".$table_arr['毕业论文(设计)指导教师成绩评定表']."','".$table_arr['评阅教师评定成绩评定表']."','".$table_arr['答辩评分表']."','".$table_arr['综合成绩评定表']."','".$table_arr['答辩记录表']."','".$table_arr['优秀论文推荐表']."')";
$first_step_rec = mysql_query($first_step,$conn);
...全文
157 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
diashuoshuo 2013-05-30
  • 打赏
  • 举报
回复
引用 7 楼 jordan102 的回复:
叫你贴出mysql_error() ; 后的结果一切就明白了
呀,谢谢你的提醒,不过那段代码直接被毙掉了。学到了mysql_error() 这个。下次我会注意。
一起混吧 2013-05-23
  • 打赏
  • 举报
回复
叫你贴出mysql_error() ; 后的结果一切就明白了
diashuoshuo 2013-05-23
  • 打赏
  • 举报
回复
引用 5 楼 xuzuning 的回复:
在你给出的 sql 指令中 字段列表为 31 个字段 参数列表为 30 项内容 两者不匹配,当然就要报错了
都是31个,我数了3便。我想会不会是字段内容太长。我这里table_arr['']里保存的是html代码。会不会表太多而又其他限制呢,我是个新手,这个问题是在麻烦。分两步走也不行。会出现要么插入10张表,或要么插入两张表这种情况(我是分为10张表一次,两张表1次)。
xuzuning 2013-05-22
  • 打赏
  • 举报
回复
在你给出的 sql 指令中 字段列表为 31 个字段 参数列表为 30 项内容 两者不匹配,当然就要报错了
diashuoshuo 2013-05-22
  • 打赏
  • 举报
回复
引用 3 楼 jordan102 的回复:
var_dump() 吧,用isset不可能为false
$first_step_rec = mysql_query($first_step,$conn); 嗯,不是isset(); 我的判断语句是 if($first_step_rec) echo "ok"; 但,没输出结果。
一起混吧 2013-05-21
  • 打赏
  • 举报
回复
var_dump() 吧,用isset不可能为false
diashuoshuo 2013-05-21
  • 打赏
  • 举报
回复
引用 1 楼 jordan102 的回复:
$first_step_rec = mysql_query($first_step,$conn) or die(mysql_error()); //这样报什么错
我现在无法调试,数据库在公司里。$first_step_rec = mysql_query($first_step,$conn)。这句执行完$first_step_rec用isset判断结果是false
一起混吧 2013-05-21
  • 打赏
  • 举报
回复
$first_step_rec = mysql_query($first_step,$conn) or die(mysql_error()); //这样报什么错

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧