Jump to content

Any errors here??


NextGenForum.net

Recommended Posts

		if($total_results >0){
	$rs = mysql_query($sql);
	$j =1;
	while($line = mysql_fetch_assoc($rs)){
			include('results_stub.tpl');
			$j++;
	}

	}
	else{
			 echo "Try searching again";

	}
	if($last != 1){
					 echo "Pages: ";
					 for($i=1;$i<($last+1);$i++){
					 		echo '<a href="?search_text='.$search_txt.'&pagenum='.$i.'">'.$i.'</a> | ';										 
					 }
	}


}

 

Can you see any errors here??

 

www.selectgreen.co.uk When you click go leaving the box empty you get this; Try searching againPages:

 

Im guessiong its a code error thats causing this. Any help appreciated thanks

Link to comment
https://forums.phpfreaks.com/topic/81946-any-errors-here/
Share on other sites

No errors really, just misplaced logic.

 

So you have $total_results at 0, then it goes to your else line, which does the first Try searching again echo, then $last appears to not equal 1 so you get your next echo of Pages:

 

So if that is a valid logic flow for your code, then just put a BR after Try searching again so it puts Pages on the next line.

Link to comment
https://forums.phpfreaks.com/topic/81946-any-errors-here/#findComment-416398
Share on other sites

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.