surreal5335 Posted January 24, 2010 Share Posted January 24, 2010 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 Link to comment https://forums.phpfreaks.com/topic/189603-trouble-selecting-post-with-an-anchor-tag/ Share on other sites More sharing options...
PHP Monkeh Posted January 24, 2010 Share Posted January 24, 2010 Should where posts.user_id = user_id not include a variable somewhere? Most likely after the = Link to comment https://forums.phpfreaks.com/topic/189603-trouble-selecting-post-with-an-anchor-tag/#findComment-1000729 Share on other sites More sharing options...
jl5501 Posted January 24, 2010 Share Posted January 24, 2010 should your post.id be posts.id ? Link to comment https://forums.phpfreaks.com/topic/189603-trouble-selecting-post-with-an-anchor-tag/#findComment-1000733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.