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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -