I've been struggling with this for over a month now and I'm stumped. I'm such a hack. I don't know much about writing functions but I have been able to manipulate php and pre-written functions.
This is what I'm trying to do:
When people register on my blog, they register through a previous post. The previous post id (let's call it postid_a) follows and populates a field in the registration page and gets permanently assigned to the new user.
When the new user makes a post, the function gets the previous post id (postid_a) and then displays the postid_a user's url. It's like saying - "this is the url of the person who signed me up."
Now in my database, I have a table called "posts" which holds the field "ID" (of each post) and a table called "users" which holds the fields "user_url" and "previous_post_id".
I've tried to play with something like:
function get_the_url() {
global $db;
$query = "SELECT
a.*,
b.user_url
FROM
$db->posts AS a,
$db->users AS b
WHERE
a.id = ?
b.id = ?";
$posts = $db->get_results($query);
return $posts;
}
I can't make it work.
I can display the previous_post_id but I can't get the user's url of the previous_post_id.
Your help would be very much appreciated.
Thank you for reading and taking time to understand.