在尝试查询INSERT时出现此错误,我必须在单击Submit按钮时运行。
<?php
if(isset($_POST['newPartbtn'])){
$result = mssql_query("INSERT INTO Parts (PartNumber) VALUES ('2222')");
if($result)
{
echo "Success";
}
else
{
echo "Error";
}
}
?>
PHP的新手,很抱歉,这是基本知识!
这是我要连接的代码,
<?php
$serverName = "Server";
$connectionInfo = array( "Database"=>"Database");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
答案 0 :(得分:0)
第一次建立新连接
<?php
if(isset($_POST['newPartbtn'])){
$conn = mssql_connect('KALLESPC\SQLEXPRESS', 'sa', 'phpfi');
$sql = mssql_query("INSERT INTO Parts (PartNumber) VALUES ('2222')");
if($result)
{
echo "Success";
}
else
{
echo "Error";
}
}
?>