105 New! Save questions or answers and organize your favorite content. I am able to get both the value and row of the mysql query result. But I am struggling to get the single output of a query. e.g.:
I need the result to display. But I am not getting the result. I have tried with the following methods:
But I didn't succeed to display (get) the actual value.
Lucio 4,3033 gold badges43 silver badges72 bronze badges asked Aug 2, 2011 at 5:45
1 You need to alias the aggregate using the
Kermit 33.4k13 gold badges83 silver badges120 bronze badges answered Aug 2, 2011 at 5:48
Shakti SinghShakti Singh 82.2k20 gold badges133 silver badges150 bronze badges 1 If you only need the value:
answered May 12, 2013 at 20:50
bmaupinbmaupin 13.1k4 gold badges81 silver badges90 bronze badges 3
Try this code.
answered Aug 2, 2011 at 5:48
avetarmanavetarman 1,2449 silver badges8 bronze badges 0 Please start using PDO. mysql_* is deprecated as of PHP 5.5.0 and will be removed entirely in 7. Let's make it easier to upgrade and start using it now.
Dharman♦ 28.1k21 gold badges75 silver badges127 bronze badges answered Aug 19, 2015 at 16:29
Lee DavisLee Davis 4,5352 gold badges26 silver badges39 bronze badges here is the code for showing no of rows in the table with PHP
answered May 26, 2018 at 13:26
1
answered Aug 2, 2011 at 5:48
fatnjazzyfatnjazzy 5,95012 gold badges55 silver badges82 bronze badges You can as well use this and upgrade to
Dharman♦ 28.1k21 gold badges75 silver badges127 bronze badges answered Aug 2, 2017 at 22:19
With mysql v5.7.20, here is how I was able to get the row count from a table using PHP v7.0.22:
The third line will return a structure that looks like this:
In which case the ending echo statement will return:
answered Nov 5, 2017 at 18:59
For mysqli users, the code will look like this:
or:
answered Sep 12, 2018 at 10:40
Result:
Dharman♦ 28.1k21 gold badges75 silver badges127 bronze badges answered Sep 19, 2019 at 13:11
Ram PukarRam Pukar 1,47113 silver badges16 bronze badges 1 You need to alias the aggregate
using the
answered Dec 26, 2018 at 12:14
Sani KamalSani Kamal 1,09914 silver badges25 bronze badges
after the so many hours excellent :) answered Dec 1, 2015 at 18:51
0 |