php
$connection = mssql_connect('server', 'username', 'password');
if ($connection) {
$query = 'INSERT INTO Users (name, email) VALUES (?, ?)';
$statement = mssql_init($query, $connection);
if ($statement) {
$name = '张三';
$email = 'zhangsan@example.com';
mssql_bind($statement, 's', $name);
mssql_bind($statement, 's', $email);
$result = mssql_execute($statement);
if ($result) {
echo '用户数据插入成功!';
} else {
echo '用户数据插入失败!';
}
} else {
echo '预处理语句初始化失败!';
}
mssql_close($connection);
} else {
echo '数据库连接失败!';
}
顶一下
(0)
0%
踩一下
(0)
0%
- 相关评论
- 我要评论
-