Total Newbie Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
chrismitchell
Forum Newbie
Posts: 5
Joined: Tue Oct 28, 2008 4:51 am

Total Newbie Question

Post by chrismitchell »

I'm very new to writing PHP code by hand and i am needing to implement a search function to search a database in wordpress.. is this possible? If so can someone point out a tutorial?

I might be wrong with this as i am going from someone else in the company i work for. He suggested that i find a PHP code to search an array through wordpress..

all sound very alien to my designer mind LOL
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Total Newbie Question

Post by jaoudestudios »

To search a column in the table called content and column called details, use something like this...

Code: Select all

$q = "SELECT * FROM content WHERE details LIKE '%".$keyword."%'"
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Total Newbie Question

Post by greyhoundcode »

Also, because its Wordpress, you might want to use the $wpdb object. You can find out some more about that by looking at http://codex.wordpress.org/wpdb_Class
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Total Newbie Question

Post by JAB Creations »

Learn relational databases which really isn't that difficult and you'll be able to program your own blog software. WordPress's code is so horrible...I can only imagine if Vladsun was paid to write a list of complaints you'd get a hundred or thousand times over your money's worth. Heck, I could probably give you ten times your monies worth.
Post Reply