SELECT POW( 5, 2 )
Output of this is
25
For negative
select pow( 4,-2);
Output is
0.065
require 'config.php'; // Database connection
for($i=1; $i<=10; $i++){
$sql=$dbo->prepare("insert into sql_pow(a,b) values($i,pow($i,2))");
if($sql->execute()){
echo " $i <br> ";
}
else{
echo " Not able to add data ";
}
}
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.