afallingpanda Posted January 8, 2014 Share Posted January 8, 2014 Hello guys, so let me give some information, i have a database which is storing some information, and im building a simple search feature which just searches for particular things in the database. however something is not working, here is my code and the results: if (isset($_POST['usernamesearch'], $_POST['gamesearch'], $_POST['modesearch'], $_POST['mapsearch'])){ $usernamesearch = $_POST['usernamesearch']; $gamesearch = $_POST['gamesearch']; $modesearch = $_POST['modesearch']; $mapsearch = $_POST['mapsearch']; class Leaderboarded{ public function fetch_all(){ global $pdo; global $usernamesearch; global $gamesearch; global $modesearch; global $mapsearch; $query = $pdo->prepare('SELECT * FROM leaderboards WHERE username="?" AND game_id="?" AND mode_id="?" and map_id="?"'); $query->bindValue(1, $usernamesearch); $query->bindValue(2, $gamesearch); $query->bindValue(3, $modesearch); $query->bindValue(4, $mapsearch); $query->execute(); return $query->fetchAll(); } } $leaderboarded = new Leaderboarded; $leaderboardeds = $leaderboarded->fetch_all(); <table cellpading=0 cellspacing=0 border=1> <tr> <th>playerID</th> <th>Username</th> <th>Rank</th> <th>System</th> <th>Wins</th> <th>Losses</th> <th>Kills</th> <th>Returns</th> <th>Verified</th> <th>Revives</th> <th>Downs</th> <th>Taints</th> <th>Rounds</th> <th>players</th> <th>LastRoundTime</th> <th>TotalTime</th> <th>mode_id</th> <th>map_id</th> <th>game_id</th> </tr> <?php foreach ($leaderboardeds as $leaderboarded){ ?> <tr> <td><?php echo $leaderboarded['player_id']; ?></td> <td><?php echo $leaderboarded['username']; ?></td> <td><?php echo $leaderboarded['rank']; ?></td> <td><?php echo $leaderboarded['system']; ?></td> <td><?php echo $leaderboarded['wins']; ?></td> <td><?php echo $leaderboarded['losses']; ?></td> <td><?php echo $leaderboarded['kills']; ?></td> <td><?php echo $leaderboarded['returns']; ?></td> <td><?php echo $leaderboarded['verified']; ?></td> <td><?php echo $leaderboarded['revives']; ?></td> <td><?php echo $leaderboarded['downs']; ?></td> <td><?php echo $leaderboarded['taints']; ?></td> <td><?php echo $leaderboarded['rounds']; ?></td> <td><?php echo $leaderboarded['players']; ?></td> <td><?php echo $leaderboarded['last_round_time']; ?></td> <td><?php echo $leaderboarded['total_time']; ?></td> <td><?php echo $leaderboarded['mode_id']; ?></td> <td><?php echo $leaderboarded['map_id']; ?></td> <td><?php echo $leaderboarded['game_id']; ?></td> </tr> <?php } ?> </table> </div><?php } } ?> Now.. this is what is outputted on the screen: http://gyazo.com/1cdd7548ee4b01c85dd4c4ca5dbdaf24 As you can see i think the problem is that the last part where the data is ment to be outputted, isnt working. but why? any help will be very appretiated, thanks Quote Link to comment https://forums.phpfreaks.com/topic/285205-problem-with-phpmysql-search-feature/ Share on other sites More sharing options...
ginerjm Posted January 8, 2014 Share Posted January 8, 2014 Try turning error checking and you'll see. ALWAYS CHECK FOR ERRORS IN YOUR CODE! Quote Link to comment https://forums.phpfreaks.com/topic/285205-problem-with-phpmysql-search-feature/#findComment-1464442 Share on other sites More sharing options...
afallingpanda Posted January 8, 2014 Author Share Posted January 8, 2014 Try turning error checking and you'll see. ALWAYS CHECK FOR ERRORS IN YOUR CODE! obviously there are not any errors lol, otherwise i would of solved it. SO I CANT CHECK FOR ERRORS IN MY CODE! Quote Link to comment https://forums.phpfreaks.com/topic/285205-problem-with-phpmysql-search-feature/#findComment-1464456 Share on other sites More sharing options...
Solution afallingpanda Posted January 8, 2014 Author Solution Share Posted January 8, 2014 this is solved now, Quote Link to comment https://forums.phpfreaks.com/topic/285205-problem-with-phpmysql-search-feature/#findComment-1464459 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.