[PHP]PDO调用存储过程
1. 数据库中已创建存储过程user_logon_check, PHP调用示例如下,
<?php
$dsn = 'mssql:dbname=MyDbName;host=localhost';
$user = 'sa';
$password = '666666';
try {
$dbCon = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
print 'Connection failed: '.$e->getMessage();
exit;
}
$username = '123';
$userpsw = '123';
//$xp_userlogon = $dbCon ->query("exec user_logon_check '$username','$userpsw'");
//mysql->call user_logon_check('$username','$userpsw');
//mysql->call user_logon_check(?,?)
$xp_userlogon = $dbCon->prepare('exec user_logon_check ?,?');
$xp_userlogon->bindParam(1,$username);
$xp_userlogon->bindParam(2,$userpsw);
$xp_userlogon->execute();
$uCol = $xp_userlogon->columnCount();
echo $uCol."<br>";
while($row = $xp_userlogon->fetch()){
for( $i=0; $i<$uCol; $i++ )
print $row[$i]." ";
print "<br>";
}
?>
相关文档:
Sometimes, you might want to get the current page URL that is shown
in the browser URL window. For example if you want to let your visitors
submit a blog post to Digg you need to get that same exact URL. There
are plenty of other reasons as well. Here is how you can do that.
Add the followin ......
iconv函数库能够完成各种字符集间的转换,是php编程中不可缺少的基础函数库。
1、下载libiconv函数库http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz;
2、解压缩tar -zxvf libiconv-1.9.2.tar.gz;
3、安装libiconv
#configure --prefix=/usr/local/iconv
#make
......
强大而且免费的 zend studio 首当其冲,可惜本人机器配置不高,运行起来十分吃力,用没两次太受罪就放弃了。
PHPEdit,短小精悍,可限时试用,感觉一般。
PHPDesigner 正在用,还是可以一试,网上的注册机出的也相当及时。 0.0
纯文本编辑 Editplus 还是常备工具。 ......
PHP 中,数据通常都是存储在MySQL数据库当中的。但是有些时候,我们还是需要使用PHP读写一些本地文件。比如生成静态页面或者数据的本地缓存。
我们用一个简单的访问日志来演示一下fopen, fread, fwrite, fclose的用法。
每当我们访问此网页的时候,会显示出访问过的IP以及访问时间;同时当前的访问也会被记 ......
<?php
header("Content-Type:image/png");
srand((double)microtime()*1000000);
$img_height=20;
$img_width=60;
$im=@imagecreate($img_width,$img_height) or die("不能初始化GD文件流");
$background_color=imagecolorallocate($im,255,255,255);
$text_color=imagecolorallocate($im,233,14,91);
......