Jump to content

Not sure which statement I need to use


artin

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/142132-not-sure-which-statement-i-need-to-use/
Share on other sites

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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.