• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

Parse error: syntax error, unexpected ':', expecting ']' in /home/content/15/6807515/html/loaddata.php on line 19

I am trying to auto timestamp I changed my code to below but I get the error

Parse error: syntax error, unexpected ':', expecting ']' in /home/content/15/6807515/html/loaddata.php on line 19

Open in new window


$con = mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db($dbname);

if (!$con)

  {
  die('Could not connect: ' . mysql_error());
  }
$sql="INSERT INTO gpscoordinates (UserName, Password1, Group1,Latitude,Longitude,dp_datatime)
VALUES
('$_POST[User]','$_POST[Password1]','$_POST[Group1]','$_POST[Latitude]','$_POST[Longitude]',''$_POST[DATETIME: Auto NOW()', NOW()] ')";




if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con)
?>

Open in new window

0
dolamitejenkins
Asked:
dolamitejenkins
  • 3
  • 3
1 Solution
 
StingRaYCommented:
What is in your variable $_POST? What is your expected in $_POST[DATETIME: Auto NOW()', NOW()]?
0
 
dolamitejenkinsAuthor Commented:
I apologize I don't understand the question... $POST isnt a variable but PHP command ....
0
 
StingRaYCommented:
Ah, $_POST is an associative array retrieved from POST body. You are addressing an element in $_POST, DATETIME: Auto NOW()', NOW(). I am wondered what is in $_POST. Can you print_r($_POST)?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
dolamitejenkinsAuthor Commented:
all of the $POST work except $_POST, DATETIME: Auto NOW()', NOW()....  tonite I added $_POST, DATETIME: Auto NOW()', NOW().
0
 
StingRaYCommented:
A key of an associative array must be "string".
0
 
dolamitejenkinsAuthor Commented:
thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now