The mysql_query() function returns a handle to the resulting table. To get an answer, you must use one of the functions for reading the result, for example, mysql_result()
$query = "SELECT COUNT(`sms_send_certificate`) FROM $userstable WHERE `sms_send_certificate` = 1"; $sms_counter_2 = mysql_query ($query, $db) or die("you have trouble"); print "sms ΠΏΠΎ ΡΠ΅ΡΡΠΈΡΠΈΠΊΠ°ΡΠ°ΠΌ: ".mysql_result($sms_counter_2, 0, 0);
However, the mysql extension is now recognized as obsolete and excluded from PHP 7; instead, it is better to use the mysqli or PDO extension.
try { $pdo = new PDO( 'mysql:host=localhost;dbname=test', 'root', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); $query = "SELECT COUNT(`sms_send_certificate`) AS total FROM $userstable WHERE `sms_send_certificate` = 1"; $sms = $pdo->query($query); $result = $sms->fetch(); echo "sms ΠΏΠΎ ΡΠ΅ΡΡΠΈΡΠΈΠΊΠ°ΡΠ°ΠΌ: ".$result['total']; } catch (PDOException $e) { echo "ΠΡΠΈΠ±ΠΊΠ° Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ Π·Π°ΠΏΡΠΎΡΠ°: " . $e->getMessage(); }