Solved

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

Posted on 2012-03-10
6
279 Views
Last Modified: 2012-03-10
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
Comment
Question by:dolamitejenkins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Expert Comment

by:StingRaY
ID: 37706037
What is in your variable $_POST? What is your expected in $_POST[DATETIME: Auto NOW()', NOW()]?
0
 

Author Comment

by:dolamitejenkins
ID: 37706103
I apologize I don't understand the question... $POST isnt a variable but PHP command ....
0
 
LVL 15

Expert Comment

by:StingRaY
ID: 37706120
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
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

 

Author Comment

by:dolamitejenkins
ID: 37706126
all of the $POST work except $_POST, DATETIME: Auto NOW()', NOW()....  tonite I added $_POST, DATETIME: Auto NOW()', NOW().
0
 
LVL 15

Accepted Solution

by:
StingRaY earned 500 total points
ID: 37706130
A key of an associative array must be "string".
0
 

Author Closing Comment

by:dolamitejenkins
ID: 37706183
thanks
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question