pow()

We can get power of any number by using pow() function in MySQL
SELECT POW( 5, 2 )
Output of this is
25
For negative
select pow( 4,-2);
Output is
0.065

Square table of number 1 to 10

We will develop a code to create square table of 1 to 10. We will be storing the data in mysql table.
Here is the code
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 ";
}

}


Download SQL dump file of this table


plus2net.com



Post your comments , suggestion , error , requirements etc here .










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer