SELECT SUM not working in php code. How do I use it with mysqli -
the name of table "hit" , name of row sum of "amount" code not working
<?php $result = $mysqli->query('select sum(amount) hits'); if (false === $result) die("select sum failed: ".mysqli_error); $row = mysqli_fetch_row($result); $sum = $row[0]; print $sum; ?>
the error "notice: use of undefined constant mysqli_error - assumed 'mysqli_error' in ..."
there no such mysqli_error()
method available in php till now. there mysql_error()
shouln't confuse it.
the solution
if (false === $result) die("select sum failed: " . $mysqli->error);
more mysqli error
Comments
Post a Comment