下一篇 » « 上一篇

odbc_binmode

作者:semirock    时间:2009-03-20    来源:http://444p.com    点击:24704    本文共1篇文章 字体:[ ]

odbc_binmode

<HTML>
<HEAD>
<TITLE>odbc_binmode</TITLE>
</HEAD>
<BODY>
<?
// get a GIF from a database and send it to browser

// connect to database
$connection = odbc_connect("store", "admin", "secret");

// execute query
$query = "SELECT picture ";
$query .= "FROM employee ";
$query .= "WHERE id=17 ";
$result = odbc_do($connection, $query);

// make sure binmode is set for binary pass through
odbc_binmode($result, 0);

// make sure longreadlen mode
// is set for echo to browser
odbc_longreadlen($result, 0);

// get the first row, ignore the rest
odbc_fetch_row($result);

// send header so browser knows it's a gif
header("Content-type: image/gif");

// get the picture php学习之家
odbc_result($result, 1);
?>
</BODY>
</HTML>
发表评论
密码: (游客不需要密码)
记住我【Alt+S 或 Ctrl+Enter 快速提交】

搜索工具


《PHP函数》点击排行