artin Posted January 23, 2009 Share Posted January 23, 2009 Hello everyone, I'm pretty new to PHP and SQL....So I was hoping I could get some help with the following problem that I'm having. I have a Wordpress blog, and I would like to do the following: For each category that I have, there is some information that I would like to add withing the post. Instead of doing it manually every time I make a post I want to use PHP & a SQL database to do that for me. I have already created a small SQL table and called it "Info". The table has three fields "info_ID" , "category" and "info_text". Now the problem is, I'm not sure how to "get" the category that i posted in, compare it with the "category" field in the "Info" table and display the "info_text" that belongs to that category. Any help would be greatly appreciated. Regards, Artin Quote Link to comment Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 I don't understand...maybe b/c i'm not familiar with word press. These are blog posts you are making. And you are trying to insert info_ID, category, and info_text into your DB??? //you need to define a connection to your DB first $sql="INSERT INTO Info (info_ID, category, info_text) VALUES ("#", "category", "text") $conn->query($sql); Quote Link to comment Share on other sites More sharing options...
nuttycoder Posted January 24, 2009 Share Posted January 24, 2009 not a simple task as word press is all object orientated the coded needed could be in any number of files your best best is to ask on the word press forum or see is there is a plugin to modify your theme. Quote Link to comment Share on other sites More sharing options...
Lodius2000 Posted January 24, 2009 Share Posted January 24, 2009 why not just use WP's built in custom fields http://codex.wordpress.org/Using_Custom_Fields Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.