Copy link to clipboard
Copied
This is my code;
$SQLx = "SELECT MIN(price_from) AS minimumprice FROM AN_pricetable WHERE accomm_id = " . $db_field['accomm_id'];
$resultx = mysql_query($SQLx);
$pricefrom = mysql_result($resultx,$i,'minimumprice');
if ($pricefrom == 0){
$pricefrom = "TBC";}
But for some reason it is not returning the minimum 'price_from' value. For example several rows in the table have the same 'accomm_id', and their values in the 'price_from' field are: 8, 12, 50 and 7, but the SQL is returning 12 as the MIN. What am I doing wrong here?
Thanks
What is the datatype of price_from? If it's a string (char) type, then 12 would be the lowest value.
Copy link to clipboard
Copied
What is the datatype of price_from? If it's a string (char) type, then 12 would be the lowest value.
Copy link to clipboard
Copied
Ahhhh it was varchar, now its int and works. Thank you!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more