-2

我正在使用以下代码,它只显示一个新行,它不显示任何内容。有什么问题?谢谢。

$result = mysql_query($sql);
echo($result."<br>");

整个代码,

<?php 
include 'dbc.php';
$LeadFirstName = $_POST['LeadFirstName'];
$LeadFirstName = $_POST['LeadFirstName'];
$LeadEmail =$_POST['LeadEmail'];
$LeadEmail2 =$_POST['LeadEmail2'];
$LeadPhone =$_POST['LeadPhone'];
$LeadCity =$_POST['LeadCity'];
$LeadAddress =$_POST['LeadAddress'];
$LeadPostcode =$_POST['LeadPostcode'];
$LeadUserId =$_POST['LeadUserId'];
$LeadLeadStatusId =$_POST['LeadLeadStatusId'];
$LeadMonth =$_POST['LeadMonth'];
$LeadAreas =$_POST['LeadAreas'];
$LeadMinPrice =$_POST['LeadMinPrice'];
$LeadMaxPrice =$_POST['LeadMaxPrice'];
$LeadMinBedrooms =$_POST['LeadMinBedrooms'];
$LeadMaxBedrooms =$_POST['LeadMaxBedrooms'];
$LeadMinBathrooms =$_POST['LeadMinBathrooms'];
$LeadMaxBathrooms =$_POST['LeadMaxBathrooms'];
$LeadMinYear =$_POST['LeadMinYear'];
$LeadNextFollowup_mm =$_POST['LeadNextFollowup_mm'];
$LeadNextFollowup_dd =$_POST['LeadNextFollowup_dd'];
$LeadNextFollowup =$_POST['LeadNextFollowup'];
$sql="INSERT INTO 'realtorl_leads'.`data (`LeadFirstName`, `LeadLastName`, `LeadEmail`, `LeadEmail2`, `LeadPhone`, `LeadCity`, `LeadAddress`, `LeadPostcode`, `LeadUserId`, `LeadLeadStatusId`, `LeadMonth`, `LeadAreas`, `LeadMinPrice`, `LeadMaxPrice`, `LeadMinBedrooms`, `LeadMaxBedrooms`, `LeadMinBathrooms`, `LeadMaxBathrooms`, `LeadMinYear`, `LeadNextFollowup_mm`, `LeadNextFollowup_dd`, `LeadNextFollowup`) VALUES ($LeadFirstName, $LeadLastName, $LeadEmail, $LeadEmail2, $LeadPhone, $LeadCity, $LeadAddress, $LeadPostcode, $LeadUserId, $LeadLeadStatusId, $LeadMonth, $LeadAreas, $LeadMinPrice, $LeadMaxPrice, $LeadMinBedrooms, $LeadMaxBedrooms, $LeadNextFollowup_mm, $LeadNextFollowup_dd, $LeadNextFollowup)";
$result = mysql_query($sql);
echo($result."<br>");
if (mysql_affected_rows($result)){
  echo("worked");
}else {
  echo("does not work");
}
?>
4

1 回答 1

1

您在查询中遗漏了一个 ` 符号。

$sql="INSERT INTO 'realtorl_leads'.`data (`LeadFirstName`, 
                                        ^

正确的查询将是

$sql="INSERT INTO 'realtorl_leads'.`data` (`LeadFirstName`, 

它现在应该可以工作了。

于 2013-09-01T09:15:18.530 回答