Simple script misbehaving

each blue div with a “y” should also have a yellow box, but the opposite is happening and I can’t find the mistake.

See script in action at:http://www.lincolnsrealdeals.com/util3.php

<?php
include_once "connect_to_mysql.php";
$result = mysql_query("SELECT * FROM stk WHERE (id = 3) OR (id = 4) OR (id = 5) OR (id = 6)") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
  $this_loc_only = $row['this_loc_only'];
  echo '<div style="height:200px;width:200px;margin:20px;background-color:cyan;">';
  if ($this_loc_only == "y") {	
    echo '<h6 style="float:left;margin:-216px 0px 0px 3px;background-color:yellow;width:55px;text-align:center;">This location only.</h5>';
    echo $this_loc_only . '</br>';
  }
  echo '</div>';
}  
?>

That -216 margin might have something to do with it. Please excuse. I forgot to adjust after the copy paste.

So is this solved now?

Yes. Thanks for asking.

On an unrelated note: use a IN() query instead of all those OR’s like:


SELECT * FROM stk WHERE id IN(3, 4, 5, 6)

Also have a look at how to hide the x-powered-by header on your server.

I love it. Thanks.