You need to alias the aggregate using the as
keyword in order to call it from mysql_fetch_assoc
$result=mysql_query("SELECT count(*) as total from Students"); $data=mysql_fetch_assoc($result); echo $data['total'];
Related Posts:
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- Fatal error: Call to undefined function mysql_connect()
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- http://localhost:80 is not working on running Apache server through UniServer ZeroXIII
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- Mysql query- How to use contains?
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
- Invalid column count in CSV input on line 1 Error
- Invalid column count in CSV input on line 1 Error
- $wpdb->update or $wpdb->insert results in slashes being added in front of quotes
- PDO with INSERT INTO through prepared statements
- phpMyAdmin: secret passphrase?
- PDO bindParam() with prepared statement isn’t working
- Forbidden :You don’t have permission to access /phpmyadmin on this server
- Creating a search form in PHP to search a database?
- How can I do ‘insert if not exists’ in MySQL?
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- MySqli Commands out of sync; you can’t run this command now
- Trying to get property of non-object in
- Fix Access denied for user ‘root’@’localhost’ for phpMyAdmin
- Getting connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
- Commands out of sync; you can’t run this command now
- Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
- PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client
- SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
- How can I do ‘insert if not exists’ in MySQL?
- Count how many files in directory PHP
- Object of class DateTime could not be converted to string
- What does it mean to escape a string?
- Convert from MySQL datetime to another format with PHP
- MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock
- mysqli::query(): Couldn’t fetch mysqli
- Unexpected Exception: SQLSTATE[HY000] [1045] Access denied for user ****@’localhost’ (using password: YES)
- Uncaught Error: Call to undefined function mysql_escape_string()
- Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
- Call to a member function on null?
- SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102
- Warning: mysqli_query() expects parameter 1 to be mysqli, resource given
- MySQL query to get column names?
- What does MYSQLI_NUM mean and do?
- Mysql where id is in array
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- What is the advantage of using try {} catch {} versus if {} else {}
- select * from table where column = value ^ column2= value
- Deprecated: mysql_query() [duplicate]
- No query results for model [App\Products] Laravel
- Fatal error: Call to a member function query() on null
- mysqlworkbench giving version error on exporting database
- How to make DROP INDEX IF EXISTS for mysql?
- What is the meaning of sprintf(): Too few arguments
- Having a problem getting mysqli_query to execute
- CodeIgniter: Unable to connect to your database server using the provided settings Error Message
- Can I store images in MySQL
- MySQL Daemon Failed to Start – centos 6
- How to insert TIMESTAMP into my MySQL table?
- How to remove index.php from WordPress site URL
- PHP Like thing similar to MySQL Like, for if statement?
- How get value from URL
- How to use Memcached with PHP7?
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ””)’ at line 2
- Email Not Sending from Byethost Hosting
- What is the difference between the ‘www’ folder and ‘htdocs’ folder?
- Notice: Trying to get property of non-object error
- undefined offset PHP error
- Call to undefined function mysql_query() with Login
- What is Options +FollowSymLinks?
- Prioritize Visible Content WordPress
- PHP json_decode() returns NULL with valid JSON?
- Why do I have to run “composer dump-autoload” command to make migrations work in laravel?
- What is unexpected T_VARIABLE in PHP?
- How to close Browser Tab After Submitting a Form?
- get type in php returns “object” and not the object type
- How to find out if you’re using HTTPS without $_SERVER[‘HTTPS’]
- How can I parse a JSON file with PHP? [duplicate]
- Object of class stdClass could not be converted to string
- How to get URL of current page in PHP
- WordPress visual composer not loading
- What does “zend_mm_heap corrupted” mean
- MySQL – count total number of rows in php
- Delete post revisions on post publish
- error importing localhost export file to server
- How to sort results from a custom database table
- How to write one comment and publish on every post using database or plugin?
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- How to get number of Affected rows from wordpress dbDelta() function
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Should I use WordPress to skin a database website?
- WordPress Custom SQL Table with UserID Filter for results
- How to use AJAX in WordPress in MYSQL query?
- Passing in MySQL prepare statement parameter separately throwing error
- Database SQL query error
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Updated Php version from 5.4 to 7.2 and getting “PHP installation missing the MySQL extension needed by WordPress”
- Moving a few select DB tables to a new WP instance
- Need help with format of nested array in MySQL
- How to get the total count of Favorite/Favorited authors
- Splash pages on a high traffic site
- how to search through plugin in wordpress cimy-user-extra-fields?
- Submit cf7 form to cfdb as pdf/BLOB [closed]