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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.