Jump to content
php.lv forumi

no XML faila uz SQL datubāzi


reGative

Recommended Posts

Sveiki!

 

Top man blogs. Šoreiz īsts un bez bet. Tātad, ir wordpress dziņa backup (raksti, komentāri). XML failā. Vajag uztaisīt tā, lai tie XML dati ieiet manā SQL datubāzē bez problēmām. Vai kādam ir risinājumi?

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Tas bija Wordpress (kā source code) vai Wordpress.com, kur pirms tam bija Tavs blogs?

 

Jebkurā gadījumā, ir jāuzraksta skripts, kurš no vecajiem datiem (SQL, XML vai kas tad Tev tur ir) atsijā derīgos un saliek jaunās datubāzes pareizajās ailēs.

Link to comment
Share on other sites

Tas bija Wordpress (kā source code) vai Wordpress.com, kur pirms tam bija Tavs blogs?

 

Jebkurā gadījumā, ir jāuzraksta skripts, kurš no vecajiem datiem (SQL, XML vai kas tad Tev tur ir) atsijā derīgos un saliek jaunās datubāzes pareizajās ailēs.

Tas bija Wordpress kā source code.

Njā, nemaz nav tik viegli...

Link to comment
Share on other sites

Ja Es būtu Tavā vietā, tad Es labāk ieietu phpMyAdmin, uztaisītu normālu bekapu (kā SQL), tad izpētītu kā tur viss turas kopā, bekapu izpildītu tukšā datubāzē, tad ar to savietos un sāktu likt bekapa datus otrajā datubāzē (kur ir Tava jaunā datubāzes struktūra). Nav ar XML tur ko ņemties!

Link to comment
Share on other sites

laikam būs vien jāinportē no tā blogger uz wordpress, no wordpress dabūt sql backupu un manuāli inportēt manā datubāzē. Vismaz labi būtu, ja nebūtu manuāli jāpielāgo tas wordpress backups manai datubāzei.

Link to comment
Share on other sites

  • 2 weeks later...

Lūdzu palīdzēt

	<item>
	<title>Kā dabūt caurspīdīgas konteksta izvēlnes uz Windows XP, Vista un 7?</title>
	<link>http://127.0.0.1/wordpress/?p=26</link>
	<pubDate>Sun, 18 Oct 2009 12:53:53 +0000</pubDate>
	<dc:creator>reGative</dc:creator>
	<guid isPermaLink="false">http://regative.zxq.net/?p=26</guid>
	<description></description>
	<content:encoded><![CDATA[Ja gribi visu Windows caurspīdīgu, tad konteksta izvēlnes arī var padarīt smuki caurspīdīgas. Tas strādā uz Windows XP, Vista un 7. Tam ir viena ļoti maza programma <strong>TCM (TransConMenu)</strong>, kuru var palaist bez instalēšanas sistēmā (jeb īsāk sakot portabla :D )<!--more-->Rezultāts ir šāds:

<img src="http://img.photobucket.com/albums/v374/vishaal_here/Transparent_Context_Menu.png" alt="http://img.photobucket.com/albums/v374/vishaal_here/Transparent_Context_Menu.png" />

Šī programma pilnībā visas konteksta izvēlnes padara jauki caurspīdīgas. Notifications joslā var nospiest uz programmas ikoniņas un izvēlēties caurspīdīguma līmeni. To var lejupielādēt <a title="TCM (TransConMenu)" href="http://www.deviantart.com/download/139799196/Transparent_Context_Menu_by_Solo_Dev.zip" target="_blank">šeit</a>.

<a title="Get Transparent Context Menus in Windows XP, Vista and 7" href="http://www.askvg.com/get-transparent-context-menus-in-windows-xp-vista-and-7/" target="_blank">Avots</a>]]></content:encoded>
	<excerpt:encoded><![CDATA[]]></excerpt:encoded>
	<wp:post_id>26</wp:post_id>
	<wp:post_date>2009-10-18 12:53:53</wp:post_date>
	<wp:post_date_gmt>2009-10-18 12:53:53</wp:post_date_gmt>
	<wp:comment_status>open</wp:comment_status>
	<wp:ping_status>open</wp:ping_status>
	<wp:post_name>ka-dabut-caurspidigas-konteksta-izvelnes-uz-windows-xp-vista-un-7</wp:post_name>
	<wp:status>publish</wp:status>
	<wp:post_parent>0</wp:post_parent>
	<wp:menu_order>0</wp:menu_order>
	<wp:post_type>post</wp:post_type>
	<wp:post_password></wp:post_password>
	<wp:is_sticky>0</wp:is_sticky>
	<category domain="category" nicename="pamacibas"><![CDATA[Pamācības]]></category>
	<wp:comment>
		<wp:comment_id>22</wp:comment_id>
		<wp:comment_author><![CDATA[daGrevis]]></wp:comment_author>
		<wp:comment_author_email>[email protected]</wp:comment_author_email>
		<wp:comment_author_url>http://dagrevis.net/</wp:comment_author_url>
		<wp:comment_author_IP>ip</wp:comment_author_IP>
		<wp:comment_date>2009-10-18 13:09:24</wp:comment_date>
		<wp:comment_date_gmt>2009-10-18 13:09:24</wp:comment_date_gmt>
		<wp:comment_content><![CDATA[Jauka tiem, kuriem patīk vizuālais, nevis ātrums. :)]]></wp:comment_content>
		<wp:comment_approved>1</wp:comment_approved>
		<wp:comment_type></wp:comment_type>
		<wp:comment_parent>0</wp:comment_parent>
		<wp:comment_user_id>0</wp:comment_user_id>
	</wp:comment>
	<wp:comment>
		<wp:comment_id>23</wp:comment_id>
		<wp:comment_author><![CDATA[Aldis]]></wp:comment_author>
		<wp:comment_author_email>[email protected]</wp:comment_author_email>
		<wp:comment_author_url>http://www.bedre.lv/</wp:comment_author_url>
		<wp:comment_author_IP>ip</wp:comment_author_IP>
		<wp:comment_date>2009-10-18 13:15:50</wp:comment_date>
		<wp:comment_date_gmt>2009-10-18 13:15:50</wp:comment_date_gmt>
		<wp:comment_content><![CDATA[bugaini... :D standarts labāks! :)]]></wp:comment_content>
		<wp:comment_approved>1</wp:comment_approved>
		<wp:comment_type></wp:comment_type>
		<wp:comment_parent>0</wp:comment_parent>
		<wp:comment_user_id>0</wp:comment_user_id>
	</wp:comment>
	<wp:comment>
		<wp:comment_id>24</wp:comment_id>
		<wp:comment_author><![CDATA[ehex]]></wp:comment_author>
		<wp:comment_author_email>[email protected]</wp:comment_author_email>
		<wp:comment_author_url>http://ehex.tk</wp:comment_author_url>
		<wp:comment_author_IP>ip</wp:comment_author_IP>
		<wp:comment_date>2009-10-18 14:11:03</wp:comment_date>
		<wp:comment_date_gmt>2009-10-18 14:11:03</wp:comment_date_gmt>
		<wp:comment_content><![CDATA[Man ar labāk patīk standarts. Šitais izskatās ne pārāk un droši vien resursus arī daudz prasa...]]></wp:comment_content>
		<wp:comment_approved>1</wp:comment_approved>
		<wp:comment_type></wp:comment_type>
		<wp:comment_parent>0</wp:comment_parent>
		<wp:comment_user_id>0</wp:comment_user_id>
	</wp:comment>
</item>

uzrakstīju šitādu te -

<?php $xml = simplexml_load_file("xml.xml");
foreach ($xml->item as $item)
{
       $id = $item ->post_id;
       $virsraksts = $item->title;
       $teksts = $item->encoded;
       }
       $con = mysql_connect("localhost","root","");
if (!$con)
 {
 die('Nav iespejams pieslegties: ' . mysql_error());
 }

 mysql_select_db("dienasgramata", $con);
       mysql_query("INSERT INTO ieraksti(id, virsraksts, ievads, teksts) VALUES ($id, $virsraksts, $ievads, $teksts)"); ?>

 

bet nestrādā man ts kods. Kas pa vainu?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...