Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Can I populate an array with variables? (also Wordpress related)
Old 12-04-2009, 05:45 PM Can I populate an array with variables? (also Wordpress related)
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
I have a situation where I would like to populate an array with variables.
(I am trying to work around(hack around) the Worpress lack of ability to query more than one post using query_posts(p=49).)

Here is a raw example:

I have an array $result which holds numbers only. (In this case, post ID results from a Wordpress query)

This is how to query more than one post as per WP forum moderator:

$args = array(
'post_type' => 'post',
'post__in' => array(65,49,32) // etc.
);
query_posts($args);

Of course, I'd like to stick the ID's that my $results array holds into this 'post__in' => array instead of manually inputting ID's(65,49,32 // numbers for example only) since it is dynamic data.

I hope I made this clear enough. Perhaps my brain is not working today!

Thanks in advance!
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
 
Register now for full access!
Old 12-04-2009, 06:22 PM Re: Can I populate an array with variables? (also Wordpress related)
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
I told you my brain wasn't working today! I had a typo in my code variables!!!

Sorry to bother!!

Now I must beg the php gods of Webmaster talk to not come down on me!

Solved.
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 12-04-2009, 08:03 PM Re: Can I populate an array with variables? (also Wordpress related)
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
You have dissappointed the gods, now feel our wrath!
PHP Code:
$you = new user("racer x");
$god = new god();
$you->feel($god->getWrath()); 
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 12-04-2009, 09:37 PM Re: Can I populate an array with variables? (also Wordpress related)
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
Thanx lizciz. LOL

I knew no one could resist.

Sometimes my brain finding the answer is like me finding 35 flat-head screwdrivers when I need the phillips. It only works after I don't need it...(e-hem...or after I post a stupid question.)

I have redeemed myself though and seek amnesty from the gods, I have solved(ok, sort of hacked) the riddle of displaying Wordpress posts based on multiple custom field meta_compare queries all while still allowing native WP pagination and without writing a SELECT query.

(For the record: you can't have more than one meta_compare for custom fields in a query_posts().)
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Reply     « Reply to Can I populate an array with variables? (also Wordpress related)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22508 seconds with 12 queries