Jump to content

trouble selecting post with an anchor tag.


surreal5335

Recommended Posts

I am going over this tutorial about selecting from a series of posts which will then be edited by the user. before adding a small snipet of code, everything is fine, now all the posts listed are not showing up on the page.

 

my find_post() function:

 


/**
* returns array of posts from database
* @returns array
*/

function find_posts() {

	$connection = db_connect();
	$query = 'select post.id as id, posts.title, posts.body, posts.user_id, users.name 
		from 
			posts, users 
		where 
                		posts.user_id = user_id	';

	$result = mysql_query($query);

	$number_of_posts = @mysql_num_rows($result);
	if ($number_of_posts == 0) {
		return false;
	}

	$result = result_to_array($result) or die("SQL failure: " . $query . ", error: " . mysql_error());


	return $result;
}

 

the new snipet is:

 

post.id as id

 

so the nice thing is we know the problem child, I just dont know how to fix it.

 

I also tried adding in:

 

order

      by posts.id desc

 

in the query but that also resulted in list of posts not showing. Any thoughts?

 

I appreciate the help

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.