如何在PHP中将数据写入MySQL表字段(列)

时间:2014-07-27 23:09:25

标签: php

我有MySQL表作为网站,有三列,一列是序列号,第二列是网站,第三列是内容。使用下面的脚本我可以遍历网站专栏并进行一些操作。现在我有每个操作的输出,我想在操作时立即将其写入内容列。

<?php
$mysqli = new mysqli("localhost", "root", "", "wte");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$query = "SELECT Website FROM websites";

if ($result = $mysqli->query($query)) {


while ($row = $result->fetch_assoc()) {

$website = $row["Website"];


$f = file_get_contents($website);

// How to write contents of $f to the Website row in my MySQL table?

}



    /* free result set */
    $result->close();
}

/* close connection */
$mysqli->close();
?>

0 个答案:

没有答案