企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
``` <?php $serverName = "11.1.111.111,11111"; $database = "XXX"; $username = 'XXX'; $password = 'XXX'; try { $conn = new PDO( "sqlsrv:server=$serverName;Database=$database", $username, $password, array( //PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) ); $stmt = $conn->prepare("INSERT INTO table_name ( KEYWORD ,LID ) VALUES ( :KEYWORD ,:LID )"); $stmt->bindParam(':KEYWORD', $KEYWORD); $stmt->bindParam(':LID', $LID); // insert a row $KEYWORD = '27'; $LID = '25'; $stmt->execute(); echo "New records created successfully"; } catch(PDOException $e) { die("Error connecting to SQL Server: " . $e->getMessage()); } $conn = null; ```