I have a function which returns the domain age of a particular domain. I want to store that value in a database after computing the domain age. I have done everything right as per my knowledge but data is not being sent to the table. My code is below,
function domainAge()
{
$con=mysqli_connect("localhost","root","","fyp");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$url=$_POST["urlo"];
require("DomainAge.class.php");
$w=new DomainAge();
echo $w->age($url);
$temp = $w->age($url);
mysqli_query($con,"INSERT INTO results(domain_age) VALUES ($temp)");
mysqli_close($con);
}
The name of the table is results and the column name is domain_age. Can you please tell me why the value is not being stored in the DB? the datatype im using is varchar for the domain_age. Thank you.