Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Count total sql row in php

$counthash = $db->getRows('SELECT * FROM table WHERE hash='.strtoupper($temphash).' ');

how to count affected row??
(Jun 30, 2019 08:53 AM)Zan0n Wrote:  $counthash = $db->getRows('SELECT * FROM table WHERE hash='.strtoupper($temphash).' ');

how to count affected row??
Affected rows or selected rows? Are you even using every single result returned in that query or are you just wasteful?

Code
SELECT COUNT(*) FROM table WHERE hash='. strtoupper($temphash) .'
1. Select a indexed row for counting, not the entire row. (eg. COUNT(id))
2. Use prepared statements unless you're a moron.

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by GeatzoMar 23, 2021 04:00 PM 1 141 Mar 23, 2021 04:00 PM
Last Post: caw
[PHP] by blackcoder00Jun 12, 2020 12:00 AM 13 214 Jun 12, 2020 12:00 AM
Last Post: DyMa
[Javascript]  by dawid17Jun 4, 2020 06:22 AM 0 99 Jun 4, 2020 06:22 AM
Last Post: dawid17