I am working on wordpress theme and failed to use arithmatics operation on wpdb->get_results().
If i write simple, then it update sucessfully in database
$sql = "SELECT room_count from " . BOOKYOURTRAVEL_ACCOMMODATION_VACANCIES_TABLE . " where accommodation_id = $accommodation_id";
$result = $wpdb->get_results($sql) or die(mysql_error());
$calc = $result;
But if I use minus operation with result it throws fatal error.
$sql = "SELECT room_count from " . BOOKYOURTRAVEL_ACCOMMODATION_VACANCIES_TABLE . " where accommodation_id = $accommodation_id";
$result = $wpdb->get_results($sql) or die(mysql_error());
$calc = $result - 1;
Error
Fatal error: Unsupported operand types in C:xampphtdocsbetawp-contentthemesbyt-childincludespost_typesaccommodations.php on line 1199
Freinds please suggest me how to resolve this. I have used result->room_count -1 but stucked on result.
If you are expecting a single result field, you should use get_var