douduan2272 2014-06-15 11:50
浏览 31

数据不存储在mysql数据库表中

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.

  • 写回答

1条回答 默认 最新

  • dongqian5569 2014-06-15 11:55
    关注

    Try this:

    mysqli_query($con,"INSERT INTO results(domain_age) VALUES ('".$temp."')");
    
    评论

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源