revmt
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: Getting last post of a userAh, I didn’t know there was a fetch row. Still new to sql. Thanks.
Forum: Plugins
In reply to: Getting last post of a userThanks apljdi! That worked, but I still had to put it in an array and get the last one, or it would return “Resource ID: #59.”
Here’s the final bit of code in case anyone ever needs to do this:
$info=mysql_query("SELECT post_content FROM wp_posts WHERE post_author = $userID ORDER BY post_date DESC LIMIT 1"); $array_content = mysql_fetch_array( $info ); $last_content = end($array_content); echo $last_content;Forum: Plugins
In reply to: Getting last post of a userThanks for the links beta, but I actually need the most recent post content by an author (for which I am passing in the user ID as a parameter), and those plugins don’t seem to handle that. This is all for a backend script, so I don’t actually need to display anything.
Forum: Plugins
In reply to: Getting last post of a userOk, I figured out that I need to put the query in an array like so:
$info=mysql_query("SELECT post_content FROM wp_posts WHERE post_author = $userID"); $array_content = mysql_fetch_array( $info ); $last_content = end($array_content); echo $last_content;But this returns the content of the first post by that user even though I use the end() function. Any pointers here?
Viewing 4 replies - 1 through 4 (of 4 total)