2017-03-06 88 views
-2

Image of PHP script error錯誤:列計數與第1行的值計數不匹配

看不到錯誤發生的位置。

***服務器名,user_n,p_word,DBNAME都填寫並連接成功*

<?php 
$servername = ""; 
$user_n = ""; 
$p_word = ""; 
$dbname = ""; 

// Create connection 
$con = mysqli_connect($servername, $user_n, $p_word, $dbname); 

// Check connection 
if (mysqli_connect_errno()) 
{echo nl2br("Failed to connect to MySQL:".mysqli_connect_error()."\n ");} 
else 
{ echo nl2br("Established Database Connection \n");} 

$sanemail = mysqli_real_escape_string($con,$_POST['email']); 
$sanpassword = mysqli_real_escape_string($con,$_POST['password']); 
$sanfname= mysqli_real_escape_string($con,$_POST['firstName']); 
$sanlname = mysqli_real_escape_string($con,$_POST['lastName']); 
$sanphone_number = mysqli_real_escape_string($con,$_POST['phoneNumber']); 
$sanorganization = mysqli_real_escape_string($con,$_POST['organization']); 
$sanjob = mysqli_real_escape_string($con,$_POST['job']); 
$sanwebsite = mysqli_real_escape_string($con,$_POST['website']); 
$sanphone_number_two = mysqli_real_escape_string($con,$_POST['secondNumber']); 
$sanemail_number_two = mysqli_real_escape_string($con,$_POST['secondEmail']); 



//insert query to insert from data into the capstone table 
$sql = "INSERT INTO user_info(email, password, fname, lname, phone_number, organization, job, website, phone_number_two, email_number_two) 
VALUES('$sanemail', '$sanpassword, '$sanfname', '$sanlname', '$sanphone_number', '$sanorganization, '$sanjob', '$sanwebsite', '$sanphone_number_two', '$sanemail_number_two')"; 

//check for error on insert 
if (!mysqli_query($con,$sql)) 
{ die('Error:' .mysqli_error($con));} 

echo "1 record added"; 
mysqli_close($con); 
?> 

Image of database values

+0

您可能想要將錯誤添加爲文本;它使我們更容易閱讀它。 –

回答

0

的問題是在哪裏創建$sql變量行:

$sql = " 
    INSERT INTO user_info(
     email, 
     password, 
     fname, 
     lname, 
     phone_number, 
     organization, 
     job, 
     website, 
     phone_number_two, 
     email_number_two 
    ) VALUES (
     '$sanemail', 
     '$sanpassword, -- HERE 
     '$sanfname', 
     '$sanlname', 
     '$sanphone_number', 
     '$sanorganization, -- AND HERE 
     '$sanjob', 
     '$sanwebsite', 
     '$sanphone_number_two', 
     '$sanemail_number_two' 
    )"; 

這兩條線:

'$sanpassword, 
'$sanorganization, 

他們缺少收盤報價。

+0

非常感謝您的及時回覆,我認爲這是一個語法錯誤,我只是需要一個額外的眼睛! –

相關問題