Jump to content

[SOLVED] Result Query - Producing extra results?


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!  ???

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.