Jump to content

[SOLVED] Server switch- "continue" not working?


kernelgpf

Recommended Posts

I switched servers, and as soon as I did, this bit of code doesn't work, it's printing everything out twice. I have PHP 5 on my new server..

 

$query=mysql_query("select indistrict,acreID,whatisbuilt,ownedby,name from land where ownedby='$vid'");
$num=mysql_num_rows($query);
if($num == "0"){
print "No acres!";
include "footer.php";
exit;
}
while($row=mysql_fetch_array($query)){
if(empty($row[whatisbuilt])){
$row[whatisbuilt]="nothing";
}
if($row[whatisbuilt] == "stable"){
print "<a href='stable.php?stableID=$row[acreID]'><b>$row[name]</b> Stable (#$row[acreID])</a> | <a href='acre.php?acreID=$row[acreID]'>[ x acre link ]</a><br>";
continue;
}
if($row[whatisbuilt] == "cage"){
print "<a href='cage.php?cageID=$row[acreID]'><b>$row[name]</b> Cage (#$row[acreID])</a> | <a href='acre.php?acreID=$row[acreID]'>[ x acre link ]</a><br>";
continue;
}
if($row[whatisbuilt] == "cave"){
print "<a href='cave.php?caveID=$row[acreID]'><b>$row[name]</b> Cave (#$row[acreID])</a> | <a href='acre.php?acreID=$row[acreID]'>[ x acre link ]</a><br>";
continue;
}
print "<a href='acre.php?acreID=$row[acreID]'>Acre #$row[acreID]</a> - <b>$row[whatisbuilt]</b> on it - in the <b>$row[indistrict]</b><br>";
}

Are you sure you don't have another loop surrounding the while loop?

Why do you have all those continues in there? It should do just fine without them.

 

I tested your code on my server, just replaced everything with my DB information and it worked fine.

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.