Page 1 of 1

I need help with a function

Posted: Tue Sep 25, 2007 8:36 pm
by DRandy
Never Mind

Not getting any help here

Posted: Wed Sep 26, 2007 3:28 am
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?

Posted: Wed Sep 26, 2007 7:28 am
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?

Posted: Wed Sep 26, 2007 12:43 pm
by DRandy
I'll try another forum

Posted: Wed Sep 26, 2007 5:39 pm
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

Posted: Wed Sep 26, 2007 6:02 pm
by DRandy
Hey Thanks

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

I'll come back tomorrow.

Posted: Thu Sep 27, 2007 5:20 pm
by DRandy
I'm leaving

Posted: Thu Sep 27, 2007 5:23 pm
by pickle
How didn't it work?

Posted: Thu Sep 27, 2007 5:29 pm
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)

Posted: Thu Sep 27, 2007 5:40 pm
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?

Posted: Thu Sep 27, 2007 5:52 pm
by DRandy
I'll work on it a while and hope to be back in a couple hours.

Thanks

Posted: Thu Sep 27, 2007 8:55 pm
by DRandy
I'll go somewhere else

Posted: Fri Sep 28, 2007 9:49 am
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.

Posted: Wed Oct 03, 2007 9:34 pm
by DRandy
Just not working here