Welcome Guest, Not a member yet? Register   Sign In
Getting duplicates in loop
#1

[eluser]cyberjunkie[/eluser]
Hello friends!

I created a controller and model and in my view I loop through a query like so..

Code:
<?php foreach($query as $row) { ?>

<p>Country: &lt;?php echo $row->country; ?&gt;</p>
<p>Website: &lt;?php echo $row->website; ?&gt;</p>

&lt;?php } ?&gt;

I'm not used with foreach loops.. why do I get

Code:
Country:

Website:

Country: USA

Website: http://www.mysite.com

?

Notice how website: and country: are duplicated. This didn't happen with while loops I think. Am I doing something wrong?
#2

[eluser]cyberjunkie[/eluser]
Sorry, nvm.. long day at work lol. I had 4 results, 2 NULL hence the dublicate..




Theme © iAndrew 2016 - Forum software by © MyBB