This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

Issue with [total]

I am working on a recording database and have run in to an issue with using 'total'. SQL: $sqla = ("select count(*) as total from sidea;"); $resulta = $conn->query($sqla); if ($resulta->num_rows > 0) { while($row = $resulta->fetch_assoc()) { $newcode = 1 + $row[total]; echo "<center>" . "Side A Index: " . $newcode . "</center>"; } } Total is giving me odd results in one instance I can add 1 to total and I get the correct number. Other times I have to add 2 to total, I'm not sure how total is stored. total should be the number of rows in the table, adding one should give me the next number but it tells me there is a duplicate ?

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.