Solved

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

Posted on 2012-03-10
6
276 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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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.

733 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