当前位置:编程学习 > php >>

php An error occured

<?php
function install_postgresql($name, $mail, $title, $content){

$pgsql_conn = pg_connect("host=localhost port=5432 dbname=book user=vi");
if (!$pgsql_conn) {
   echo "connect database error.\n";
   exit;
}

$result = pg_query($pgsql_conn, "INSTER INTO topic (man, mail, title, content) VALUES ('$name', '$mail', '$title', '$content');");
if(!$result){
        echo "An error occured.\n";
        exit;
}

pg_close($pgsql_conn);
}
?>

注要是你在sql后面加了;号,去了就行了,

补充:Php教程,常见问题 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,