Solved

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

Posted on 2012-03-10
6
267 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
Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

707 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

18 Experts available now in Live!

Get 1:1 Help Now