PHP RSS generator using simple xml

Today`s project was to generate an rss feed for the records in my web-project site using simple xml.

I new that most of the work had already been done, since i created the sitemap for my project. Check here.

So with a little search on the net i found some help. I am not going to write down all the steps that i ve taken to modify code written by others..but just to share some useful resources in case some novice php developer needs to do the same..

Initially i matched my existing code with the example written by Spotless Web Design. What a great and descriptive article…

Most of the word had already been done, but i needed to add some more quality stuff in the raw xml file like the atom link, so i got some more help from this guy.

Finally in order to validate the rss, i visited FeedValidator a couple of times.

 

That`s it for today … Next project is to link this RSS feed with an IFTTT rule to automatically post images to pintrest and twitter.. lets see how this goes.

Mysql Duplicate and Modify Row

I was trying to find an easy way to duplicate a table row in mysql, and it appears that mysql can handle that pretty easily.  Just Use:

insert INTO `server`.`ad` (`adgrp`,`adname`,`ad`,`adlink`,`adtype`,`adprovider`,`visible`) SELECT `adgrp`,`adname`,`ad`,`adlink`,`adtype`,`adprovider`,`visible` FROM `server`.ad where idad=46;

to duplicate any row on any table, or use the  CONCAT() function to add text to the newly created row. In my case i needed to set the name just to be “_copy” of the original one:

insert INTO `server`.`ad` (`adgrp`,`adname`,`ad`,`adlink`,`adtype`,`adprovider`,`visible`) SELECT `adgrp`,CONCAT(`adname`,"_COPY"),`ad`,`adlink`,`adtype`,`adprovider`,`visible` FROM `server`.ad where idad=46;

In the case above the idad column is of course the primary key and auto-increment, so it cannot be copied.