I have a database with around 50 columns, 1 column is "name" and the other columns are "item1, item2, item3" and so on.
I've got the following script to select the highest value from the item columns:
$sql1 = "SELECT max(item1), name FROM pricelist";
$result1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_array($result1);
$item1_1 = $row1['max(item1)'];
$item1_2 = $row1['name'];
It works fine but it isn't selecting the correct name.. I think it's because I'm not telling it which name to actually select.
Hopefully someone can help..