viion Posted October 13, 2009 Share Posted October 13, 2009 I'm extremely confused why this is not working. the sql column names are correct, just something is not working, here are the 2 pieces of code, they do not run at the same time on the site infact the working piece i dont even use at the moment, but they're almost identical but the piecei need wont work! I'm using OO sql through mysqli btw. Here is the working code: $query = $db->query("SELECT * FROM countries WHERE value LIKE '$queryString%' LIMIT 10"); if($query) { while ($result = $query->fetch_object()) { echo '<li onClick="fill(\''.$result->value.'\');">'.$result->value.'</li>'; } } else { echo 'ERROR: There was a problem with the query.'; } Here is the piece that doesnt work, which i wish would. $query = $db->query("SELECT gamename, linkuser FROM ogd_projects_main LIMIT 10"); if($query) { while ($result = $query->fetch_object()) { echo $result->gamename; } } else { echo 'ERROR: There was a problem with the query.'; } Anyone notice anything wrong? When the second piece runs, it just stops the render of the page, anything below it will not be considered. Like die(); Link to comment https://forums.phpfreaks.com/topic/177524-2-pieces-of-code-almost-identical-1-works-1-doesnt/ Share on other sites More sharing options...
trq Posted October 13, 2009 Share Posted October 13, 2009 Just because $query is true doesn't mean you have any results, have you tried checking that? Link to comment https://forums.phpfreaks.com/topic/177524-2-pieces-of-code-almost-identical-1-works-1-doesnt/#findComment-935994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.