I need help with a function

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
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

I need help with a function

Post by DRandy »

Never Mind

Not getting any help here
Last edited by DRandy on Mon Nov 26, 2007 10:54 pm, edited 1 time in total.
__Cody__
Forum Newbie
Posts: 9
Joined: Sat Sep 08, 2007 7:01 am

Post by __Cody__ »

Not sure why you would want to show one users URL in another users post, how are they linked? or is it a random users URL? or is a user selecting what URL they want in their post?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

I'm not sure how you could have gotten as far as you have, and then suddenly become unable to accomplish this task. Perhaps more detail is needed?
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

I'll try another forum
Last edited by DRandy on Mon Nov 26, 2007 10:54 pm, edited 1 time in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Something like this?

Code: Select all

SELECT
  a.*,
  b.user_url
FROM
  posts as a,
  posts as b
WHERE
  a.id = 'id of post1' AND
  a.newpostid = b.id
That query is ugly & uses what's called a JOIN in the WHERE clause
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

Hey Thanks

I'll look that over and see what I can do.

I'll come back tomorrow.
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

I'm leaving
Last edited by DRandy on Mon Nov 26, 2007 10:57 pm, edited 1 time in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

How didn't it work?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

I got a error message displaying on my page:

Fatal error: Call to a member function get_results() on a non-object in ...(my file where I put the code)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

So that means the get_results() function can't be called because $db isn't an object in that function. Is $db declared globally? How do you get $db into your get_the_url() function?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

I'll work on it a while and hope to be back in a couple hours.

Thanks
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

I'll go somewhere else
Last edited by DRandy on Mon Nov 26, 2007 10:55 pm, edited 1 time in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You'll need to call get_th_referringauthor_postid() from within your get_the_url() function.

Declaring globals all over the place is generally considered bad form. You might want to consider encapsulating your functionality in a class.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
DRandy
Forum Newbie
Posts: 10
Joined: Sun Aug 26, 2007 12:43 pm

Post by DRandy »

Just not working here
Post Reply