View Single Post
Old 11-27-2012, 04:20 PM   PM User | #22
stevenryals
New Coder

 
Join Date: Jul 2012
Posts: 60
Thanks: 4
Thanked 0 Times in 0 Posts
stevenryals is an unknown quantity at this point
OK.. I think i'm very close now..

when i vardump as shown below i get: about 500 lines of this:
Quote:
array(4) { [0]=> NULL ["tag"]=> NULL [1]=> NULL ["MIN(`price`)"]=> NULL } 0.779177 array(4) { [0]=> NULL ["tag"]=> NULL [1]=> NULL ["MIN(`price`)"]=> NULL } 80.4506 array(4) { [0]=> NULL ["tag"]=> NULL [1]=> NULL ["MIN(`price`)"]=> NULL } 0.779177 array(4) { [0]=> NULL ["tag"]=> NULL [1]=> NULL ["MIN(`price`)"]=> NULL } 80.4506 array(4) { [0]=> NULL ["tag"]=> NULL
So i'm obviously not passing $rows[`tag`] correctly into the new query.. and also, not sure where all the 0.779177 and all those numbers are coming from either??


Code:
$result = mysql_query("SELECT * FROM {$table}");
if (!$result) {
    die("Query to show fields from table failed");
}

$fields_num = mysql_num_fields($result);


while($rows=mysql_fetch_array($result))  {

$min = mysql_query("SELECT `tag`, MIN(`price`) FROM {$table} AS `minprice` where `tag` = ' . rows[`tag`] . '") or die(mysql_error());
$minrow = mysql_fetch_array($min) or die(mysql_error());
var_dump($minrow);

$rownumber++;
echo "<tr title='Lowest Price is " . $minrow['minprice'] . "'>";
echo "<td align='center'> $rownumber </td>";

mysql_free_result($min);
?>
<td align='center' border='1' frame="box" rules="all"><? echo $rows['tag']; ?></td>
<td align='center' border='1' frame="box" rules="all"><? echo $rows['url']; ?></td>

<?php

}
?>
</table>
<?php

mysql_free_result($result);
mysql_close();
?>
I think i'm very close on this... i can taste it LOL
stevenryals is offline   Reply With Quote