vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Help importing WordPress tables into vB tables? (https://vborg.vbsupport.ru/showthread.php?t=275147)

AFemaleProdigy 12-07-2011 04:21 AM

Help importing WordPress tables into vB tables?
 
I am working on merging/importing WordPress content into vB 4.1.8. Since the WordPress version is not one supported by Impex, I am having to import a lot of the content manually. Impex did allow me to import all of the user data and part of the WP posts data, but some of it would not transfer over.

In particular, I am attempting to copy over the WP post_date into vB dateline columns. I have noticed that the format for the dates is different. In vB, the dates look something like this "1311841061" and in WP they look like this "2011-07-14 04:35:36". Does anyone know how I can correctly convert that so it copies over in the correct format?

Thanks!

--------------- Added [DATE]1323235634[/DATE] at [TIME]1323235634[/TIME] ---------------

Also, does anyone have any advice for me as I am doing this merge manually without Impex for the first time? I haven't been able to find any mods, instructions, or anything that do this with vB 4.x. so I am winging it.

Bob Meta 12-08-2011 01:24 AM

I find this site to be very useful for converting dates to unix timestamps: http://www.epochconverter.com/. Hope this helps!

LifesGreatestGift 12-08-2011 02:25 AM

this may be a good guide for converting the table/column to the proper time format. (in phpmyadmin or something similar)

http://stackoverflow.com/questions/1...mysql-datetime

remember to backup before modifying.

AFemaleProdigy 12-09-2011 05:54 AM

Awesome! I will check out those links. Thanks!!

AFemaleProdigy 01-08-2012 07:02 AM

After much research and trial and error, I find myself a bit frustrated. I am on the right path, but can't get the queries quite right. Any assistance would be greatly appreciated.

I know I need to convert the database field type DATETIME to UNIXTIME. I figured out how to display the whole field in UNIXTIME with the query below, but it does not permanently convert or save it.

Code:

SELECT UNIX_TIMESTAMP(`post_date`) FROM `wp_posts`
I also tried this (total experiment... don't laugh ;)) with no luck...

Code:

ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int(11) NOT NULL
ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL
UPDATE `wp_posts` SET `post_date`=FROM_DATETIME(post_date_old)


kh99 01-08-2012 02:47 PM

Quote:

Originally Posted by AFemaleProdigy (Post 2285088)
Code:

ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int(11) NOT NULL
ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL
UPDATE `wp_posts` SET `post_date`=FROM_DATETIME(post_date_old)



I think I would have tried something like this - what happened when you tried?

AFemaleProdigy 01-08-2012 05:23 PM

I get this error...

Code:

Error

SQL query:

ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int( 11 ) NOT NULL ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL UPDATE `wp_posts` SET `post_date` = FROM_DATETIME( post_date_old
)
MySQL said: https://vborg.vbsupport.ru/external/2012/01/58.png
#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 'ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL
UPDATE `wp_posts` SET ' at line 2


kh99 01-08-2012 05:29 PM

Those are three separate queries, so they need to be executes separately. I think the error's saying it got confused when it reached the second query.

AFemaleProdigy 01-08-2012 06:34 PM

The first line executes properly. The second line didn't work.

kh99 01-08-2012 06:48 PM

Oh...oops, should have noticed that. I guess there is no "UNIXTIME" type, so you just want it to be int(10) .


All times are GMT. The time now is 08:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01137 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete