Solved

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

Posted on 2012-03-10
6
271 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
  • 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

948 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now