Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Problem upload Database with PHPMYAdmin

Posted on 2006-05-23
6
Medium Priority
?
352 Views
Last Modified: 2013-12-12
Hi all,
For some reason PHPMYAdmin it isn't accepting my TIMESTAMP on update statement. This SQL statement does work when I run it independent of PHPMYADMIN so I'm not sure what's wrong? This is the error it gives:
Thanks,
D
SQL query:

-- ----------------------------
-- Table structure for details_table
-- ----------------------------
CREATE TABLE `details_table` (
`det_user_id` int( 11 ) NOT NULL AUTO_INCREMENT , `det_username` varchar( 255 ) default NULL , `det_email_add` varchar( 255 ) default NULL , `det_model_id` int( 11 ) default NULL , `det_checked` enum( 'Y', 'N' ) NOT NULL default 'N', `date` timestamp NULL default '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP , PRIMARY KEY ( `det_user_id` )
)

MySQL said: Documentation
#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`det_user_id`)
)  

0
Comment
Question by:dereksheahan
  • 3
  • 3
6 Comments
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 16743915
There is no problem with the query. Put a ; (semicolon) at the end of the statement like

CREATE TABLE `details_table` (
`det_user_id` int( 11 ) NOT NULL AUTO_INCREMENT , `det_username` varchar( 255 ) default NULL , `det_email_add` varchar( 255 ) default NULL , `det_model_id` int( 11 ) default NULL , `det_checked` enum( 'Y', 'N' ) NOT NULL default 'N', `date` timestamp NULL default '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP , PRIMARY KEY ( `det_user_id` )
);


I think you have many SQL statments in this file, every sql statement should end with ;
0
 

Author Comment

by:dereksheahan
ID: 16750781
Sorry wasifg,
I just printed the error statement not the source of what I was trying to upload. I had the semi-colon alright at the end of the line. Any other ideas as to what might be wrong?
Thanks,
D
-- ----------------------------
-- Table structure for details_table
-- ----------------------------
CREATE TABLE `details_table` (
  `det_user_id` int(11) NOT NULL auto_increment,
  `det_username` varchar(255) default NULL,
  `det_email_add` varchar(255) default NULL,
  `det_model_id` int(11) default NULL,
  `det_checked` enum('Y','N') NOT NULL default 'N',
  `date` timestamp NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`det_user_id`)
) ;
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 16752503
>>>This SQL statement does work when I run it independent of PHPMYADMIN
Did you execute on the same machine where PHPMYADMIN is installed? Can you clarify this? It seems that PhpMyAdmin is using different mysql version.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dereksheahan
ID: 16753282
Yes, I'm having the same problem. It works on my local machine but when I try to upload it to the web-server using PhpMyAdmin it gives me the above error. I am using MYSQL Server 5.0 on my local machine and I just saw that the server is using 4.0.26 standard. Do you think this is the problem? Is there any way around this other than changing my version back to the older one?
Thanks,
D
0
 
LVL 20

Accepted Solution

by:
Muhammad Wasif earned 1400 total points
ID: 16753560
I am not sure whether this solution will work or not, give it a try. Execute the below sql on your server. I have removed 'on update CURRENT_TIMESTAMP'. If this work, then you have to remove these from your sql file.

CREATE TABLE `details_table` (
  `det_user_id` int(11) NOT NULL auto_increment,
  `det_username` varchar(255) default NULL,
  `det_email_add` varchar(255) default NULL,
  `det_model_id` int(11) default NULL,
  `det_checked` enum('Y','N') NOT NULL default 'N',
  `date` timestamp NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`det_user_id`)
) ;
0
 

Author Comment

by:dereksheahan
ID: 16770335
Hi Wasifg,
that got problem sorted anyways :). On your adivce I suggested to my web hosting company to upgrade their version of MYSQL to 4.1 at least. When they upgraded (last night) the TIMESTAMP function was supported in this version and so I had no problem. Thanks so much for your help.
D
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…
Suggested Courses

571 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