0

在这方面很新。我提交了我的输入表单,没有出现错误。当我去检查 myphpadmin 的条目时,创建了一行,但所有字段都是空白的。

不知道发生了什么,因为我的文本代码只有 4 个条目有效。

<?php

$subscribingcompany= $_POST["subscribingcompany"];
$biztype= $_POST["biztype"];
$sitename= $_POST["sitename"];
$siteadd1= $_POST["siteadd1"];
$city1= $_POST["city1"];
$zip1= $_POST["zip1"];
$state1= $_POST["state1"];
$country1= $_POST["country1"];
$biladd1= $_POST["biladd1"];
$city2= $_POST["city2"];
$zip2= $_POST["zip2"];
$state2= $_POST["state2"];
$country2= $_POST["country2"];
$fename= $_POST["fename"];
$lename= $_POST["lename"];
$email1= $_POST["email1"];
$phone1= $_POST["phone1"];
$foname= $_POST["foname"];
$loname= $_POST["loname"];
$email2= $_POST["email2"];
$phone2= $_POST["phone2"];
$effdate= $_POST["effdate"];
$camquantity= $_POST["camquantity"];
$currency= $_POST["currency"];
$quantity= $_POST["quantity"];

$database="greenguy_cbrsandbox";
$table="DesignPartner"; 

//Create connection and select database 
$con= mysql_connect("example.com", "greenguy_ccb", "password88") or         die(mysql_error());
echo "connected";  
mysql_select_db("$database", $con) or die(mysql_error());
echo"database found";

 //Insert into Table
 $insert =  "INSERT INTO $table 
            (id, subscribingcompany, biztype, sitename, siteadd1,   city1, zip1, state1, country1, biladd1, city2, zip2, state2, country2, fename, lename, email1, phone1, foname, loname, email2, phone2, effdate, camquantity, currency, quantity) 
        VALUES  
            (DEFAULT,'$subscribingcompany','$biztype','$sitename','$siteadd1','$city1','$zip1','$state1','$country1','$biladd1','$city2','$zip2','$state2','$country2','$fename','$lename','$email1','$phone1','$foname','$loname','$email2','$phone2','$effdate','$camquantity','$currency','$quantity')";

$results =mysql_query($insert) or die(mysql_error());

echo"data inserted succesfully";    

mysql_close($con); 
  ?>
4

1 回答 1

0

您的插入查询工作正常,因为您提供了自动增量功能行正在创建但其余值未插入请在执行期间回显您的查询。

使用echo $insert了解查询执行时插入的内容。

于 2013-09-16T07:05:09.807 回答