Jump to content

[SOLVED] Result Query - Producing extra results?


e1seix

Recommended Posts

what am i doing wrong here guys?

 

$startrow=0;

$limit=20;

 

$qry = mysql_query("SELECT bodycare.*, haircare.* FROM bodycare, haircare WHERE bodycare.avail='true' AND haircare.avail='true' LIMIT $startrow, $limit")or

die(mysql_error());

 

it should return 6 results between bodycare and haircare. instead it returns 8, - 4 repeats of the first haircare product and 4 of the second haircare product. There are only 2 haircare products in total and 4 bodycare, but the bodycare aren't turning up at all

 

why? can you help me fix it?

echo "<td class='mid_col' valign='top'>";

 

 

mysql_connect("*.*.*.*", "***_*****", "********") or die(mysql_error());

mysql_select_db("****_**") or die(mysql_error());

 

$startrow=0;

$limit=20;

 

$qry = mysql_query("SELECT bodycare.*, haircare.* FROM bodycare, haircare WHERE bodycare.avail='true' AND haircare.avail='true' LIMIT $startrow, $limit")or

die(mysql_error());

 

echo "<table><tr>";

$i=0;

while ($row = mysql_fetch_array($qry))

{

    if ($i >3)

    {

        echo "<tr>";

        $i=0;

    }

 

 

    echo "<td style='font-size:10px;text-align:center;width:125px' valign='top'>";

    echo '<a href="'.$_HTTPS['PHP_SELF'].''.$row['page'].'.php?sku='.$row['sku'].'"><img alt="'.$row['title'].'" height="100" src="'.$_HTTPS['PHP_SELF'].'/images/'.$row['ima_link'].'.jpg" width="100" /></a><br />';

    echo "<div style='border: 1px solid #000000'><div style='display:block;height:60px'>";

    echo '<a href="'.$_HTTPS['PHP_SELF'].''.$row['page'].'.php?sku='.$row['sku'].'" style="color:#000000">';

    echo "<span style='font-size:12px;text-align:center'>";

    echo $row[title]."</span> / <span style='font-size:12px;text-align:center'>";

    echo $row[brand]."</span> <span style='font-size:12px;text-align:center'>";

    echo $row['size']. " ". $row['type']."</span></a></div><br />";

 

    echo '<div>';

    echo '<a href="'.$_HTTPS['PHP_SELF'].''.$row['page'].'.php?sku='.$row['sku'].'"><img alt="INFO" height="15" src="/INFO.gif" width="50" /></a>';

    echo '<a href="'.$row['buy_link'].'" target="_new"><img alt="BUY" height="15" src="/BUY.gif" width="50"

/></a></div><br />';

 

    echo '<div style="background-image:url(bg3.JPG);border 1px solid #000000"><span style="color:#ffffff;font-size:12px;font-weight:bold">RRP <span style="color:#ffffff;font-size:12px;font-weight:bold">£<span style="color:#ffffff;font-size:12px;font-weight:bold;text-decoration: line-through">';

    echo $row[rrp]."</span><br /><span style='color:#ff9999;font-size:12px;font-weight:bold'>Our Price <span style='color:#ff9999;font-size:16px;font-weight:bold'>";

    echo "£".$row[£]."</span><br /><span style='color:#ffffff;font-size:12px;font-weight:bold'>";

 

$save=($row[rrp]-$row[£]);

$saving = number_format($save, 2, '.', '');

$perc=($save/($row[rrp]/100));

$percentage = number_format($perc, 2, '.', '');

 

    echo "Saving <span style='color:#ffffff;font-size:12px;font-weight:bold'>£".$saving." (".$percentage."%)</span></div></div></td>";

 

    $i++;

}

 

echo "</td></tr>";

 

please ignore the fact the coding is far from tidy expecially the main results display bit, but can you guys figure this out at all. i'm really struggling!  ???

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.