本文介绍了insert命令中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! hi 我是php新手。我无法将数据插入mysql表。并且没有错误提示下面是我的代码。请帮助我。 <?php include_once ' ../ inc / header.php'; if (isset($ _ POST [' 提交'])&& $ _POST [' submit']!= ) { $ name = $ _POST [ name]; $ address = $ _POST [ 地址]; $ tel = $ _POST [ tel ]; $ fax = $ _POST [ fax ]; $ email = $ _POST [ email ]; $ website = $ _POST [ website ]; $ type = $ _POST [ type ]; 尝试 { $ sql = INSERT INTO bk_customer(id,name,address,tel,fax,email,type,website) VALUES('$ name','$ address','$ tel','$ fax , '$电子邮件', '$网站', '$类型'); $ result = mysqli_query($ con,$ sql); exit(); } catch (例外$ ex) { echo $ e-> getMessage()。 \ n; file_put_contents(' PDOErrors.txt',$ e-> getMessage(),FILE_APPEND ); exit(); } } mysqli_close($ con); ?> 解决方案 _POST [' submit'])&& _POST [' submit']!= ) { name = hiI am new in php. I could not insert the data into mysql table. and there is no error prompt Below is my code. Pls help me.<?phpinclude_once '../inc/header.php';if (isset($_POST['submit']) && $_POST['submit'] != "" ) { $name = $_POST["name"]; $address = $_POST["address"]; $tel = $_POST["tel"]; $fax = $_POST["fax"]; $email = $_POST["email"]; $website = $_POST["website"]; $type = $_POST["type"]; try { $sql="INSERT INTO bk_customer (id,name,address,tel,fax,email,type,website) VALUES ('$name','$address','$tel','$fax','$email','$website','$type')"; $result = mysqli_query($con,$sql) ; exit(); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } }mysqli_close($con);?> 解决方案 _POST['submit']) &&_POST['submit'] != "" ) { name = 这篇关于insert命令中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-22 21:20