Common methods of fetching data from MySQL database using Core PHP
Some common methods of fetching data from the MySQL database have been mentioned below:
Single Line MySQL object fetching method:
This format is used when we want to fetch only a single object value from the query, it uses less no of lines in code
$ord_cnt = (int)$db->query("SELECT COUNT(id) as a FROM table1 WHERE id='1'")->fetch_object()->a;