Jump to content

2 pieces of code almost identical, 1 works 1 doesnt


viion

Recommended Posts

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();

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.