0

I am trying to do a count of all types in there(hardware and software) I thought i had the correct structure...but I guess i am wrong...

$count = mysqli_query($mysqli, "SELECT COUNT(*) AS total_count FROM assets WHERE cust_id=$custID AND (asset_type='hardware' AND asset_type='software') ");
echo mysqli_error($mysqli);
$count = mysqli_fetch_object($count);
$count = $count->total_count;

any help would be great..

1
Contributor
1
Reply
18
Views
3 Years
Discussion Span
Last Post by patk570
1

Fixed it:

$count = mysqli_query($mysqli, "SELECT (SELECT COUNT(*) FROM assets WHERE cust_id=$custID AND asset_type='hardware') + (SELECT COUNT(*) FROM assets WHERE cust_id=$custID AND asset_type='software') AS total_count");
echo mysqli_error($mysqli);
$count = mysqli_fetch_object($count);
$count = $count->total_count;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.