I'm using CodeIgniter and MySQL as db. I know it can be solved with MySQL query, but I wonder if it can be solved with a CodeIgniter query, otherwise normal PHP MySQL query can work also.
I have Table with 3 columns, it has many fields but I have shown here 4 entries, I didn't want to make a table with many columns but only 1 row of data. so instead I went for this style of table as someone suggested on this website.
Problem is I never worked with this kind of table.
SettingsID SettingsKey SettingsValue
----------------------------------------------------------------------
1 | facebookLink | facebook.com
2 | twitterLink | twitter.com
3 | youtubeLink | youtube.com
4 | googlePlusLink | googleplus.com
Now I want to run a query that should return me rows in to columns. I searched over net and found some solutions but I am not good with these new queries.
I suppose this guy had same kind of problem like I have but in his case he has same value repeated in column, where my SettingsKey has all the values unique. Here is the link to similar kind of question :
mysql select dynamic row values as column names, another column as value
I can't understand his query and that query I am not sure if is any use of me.
How can I build a query to return row values of SettingsKey as columns?