请问这个代码有什么问题?
$host = "localhost";
$database = "dbname";
$username = "postgres";
$password = "password";
$inf = "information_schema";
$db = new PDO("pgsql:dbname={$database};host={$host};port=5432", $username, $password);
!$db && exit("Database connect failed");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$handle = fopen("code.txt", "r");
if ($handle) {
$array = array();
while (($line = fgets($handle)) !== false) {
preg_match("/(.*?)\s\((.*?)\)/i", $line, $match);
$query = "INSERT INTO combo (group,html,value) VALUES(?,?,?)";
$s = $db->prepare($query);
$s->bindParam(1, $group);
$s->bindParam(2, $html);
$s->bindParam(3, $value);
$group = "state";
$html = $match[1];
$value = $match[2];
$s->execute();
}
var_dump($array);
}
我收到此错误。我也尝试过param名称,例如:html,:value但这不起作用并给出相同的错误。
pelase告诉你这个问题是什么
答案 0 :(得分:2)