spencer9772 Posted December 23, 2014 Share Posted December 23, 2014 Hey guys so my code below is not working, it will get the app information for the user but its only display 3 results like every time a new user "installs" an new app like it stops showing the last result and starts displaying the new result. Like for example right now it should be showing 7 results but only displaying 3 is there something wrong with my query. (PS: this is just developement testing purposes so thats why my code is sorta sloppy) Thanks! $default_apps = mysql_query("SELECT * FROM apps WHERE `default`='1'") or die(mysql_error()); $user_apps = mysql_query("SELECT * FROM user_apps WHERE `user_id`='$user_id'") or die(mysql_error()); while($row = mysql_fetch_array($default_apps)) { $url = $row['download_url']; $name = $row['name']; echo $row['name']; echo "<a href='$url'>$name</a><br />"; } while($raw = mysql_fetch_array($user_apps)){ $app_id = $raw['app_id']; } $select_user_apps = mysql_query("SELECT * FROM apps WHERE `app_id`='$app_id' "); while($rop = mysql_fetch_array($select_user_apps)) { $name = $rop['name']; $url = $rop['download_url']; echo $name; echo $url; } Quote Link to comment Share on other sites More sharing options...
Frank_b Posted December 23, 2014 Share Posted December 23, 2014 i bet that your last insert queries did not work. You can retrieve users and apps in one query. Maybe you should take a moment to read a bit on the internet? SELECT u.user_id, u.firstname, u.email, a.app_id, a.name, a,download_url FROM users u JOIN users_apps j ON u.user_id=j.user_id JOIN apps a ON a.app_id=j.app_id WHERE u.user_id=123 AND a.default=1 If you are starting right now, do not use the mysql_ functions. They are deprecated! Instead try to learn PDO or minimal mysqli_ functions. to improve security use prepared statements too. If you are using the mysqli_ functions do not forget that these functions can return errors. If you do not handle these errors you wont see them and you want know what is going wrong. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted December 23, 2014 Share Posted December 23, 2014 And try to write better English when you post such long descriptions. It makes it easier for us to read and, uh, like, understand what you are saying. Helps when you break up your thoughts into sentences with punctuation and capital letters. Sloppy code is uh, like, forgivable in a uh, like, learning situation, but not uh like sloppy English. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.