现有一张表:a,字段如下: pid int 4 图片编号
pic1 image max 图片照片1
pic2 image max 图片照片2
pic3 image max 图片照片3
pic4 image max 图片照片4
opcode varchar(20) 20 操作员
opdate datetime 8 (getdate()) 操作日期 里面现有数据3条,pid为8,9,10我想循环显示出来每条记录的4张图片,如何做呀?
pic1 image max 图片照片1
pic2 image max 图片照片2
pic3 image max 图片照片3
pic4 image max 图片照片4
opcode varchar(20) 20 操作员
opdate datetime 8 (getdate()) 操作日期 里面现有数据3条,pid为8,9,10我想循环显示出来每条记录的4张图片,如何做呀?
解决方案 »
- 正则表达式匹配,并替换部分字符
- 想请教一下 多线程编程 多进程编程是什么意思?PHP网站,是不是有一个用户连接,就会在服务器端产生一个进程?
- 诚招网站开发人员!(西安)
- 生成HTML遇到的问题
- 博客中的tag用程序怎么实现
- 如何设计中英文网站?
- 开发在线支付的点卡销售平台,应该注意哪些方面的安全问题?
- php在2003上安装问题在线等
- 函数前面的'@'是什么作用?
- PHP提议:成立北京市程序员联盟/俱乐部(北京程序员之家),为北京程序员服务,请大家各抒己见!
- linux环境下发邮件错误,auth password error: 421 out of memory (#4.3.0)
- Zend Studio for Eclipse--新建项目问题
header("Content-type:image/ ");
// Server in the this format: <computer>\<instance name> or // <server>,<port> when using a non default port number$server = 'KALLESPC\SQLEXPRESS';
$link = mssql_connect('192.168.1.11:1433', 'sa', '123');if(!$link)
{
die('Something went wrong while connecting to MSSQL');
}
else{
mssql_select_db('DATABASE_DATA', $link);
//$version = mssql_query('SELECT * from RGraph'); //$sql ="EXEC WhateverSProcYouWant some_arguments"; $data = mssql_query('SELECT * from RGraph where sn = 783', $link);
$row=mssql_fetch_array($data);
echo $row["sFile"];
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<table width="100%" border="0">
<tr>
<td><img border="0" src="pic.php" ></td>
</tr>
</table>
</body>
</html>
---------------
<?php
/* Connect to the local server using Windows Authentication and
specify the AdventureWorks database as the database in use. */
$serverName = "(local)";
$connectionInfo = array( "Database"=>"AdventureWorks");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}/* Set up the Transact-SQL query. */
$tsql = "SELECT LargePhoto
FROM Production.ProductPhoto
WHERE ProductPhotoID = ?";/* Set the parameter values and put them in an array. */
$productPhotoID = 70;
$params = array( $productPhotoID);/* Execute the query. */
$stmt = sqlsrv_query($conn, $tsql, $params);
if( $stmt === false )
{
echo "Error in statement execution.</br>";
die( print_r( sqlsrv_errors(), true));
}/* Retrieve and display the data.
The return data is retrieved as a binary stream. */
if ( sqlsrv_fetch( $stmt ) )
{
$image = sqlsrv_get_field( $stmt, 0,
SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
header("Content-Type: image/jpg");
fpassthru($image);
}
else
{
echo "Error in retrieving data.</br>";
die(print_r( sqlsrv_errors(), true));
}/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>
------
SQL SERVER 2000 用 MSSQL扩展库的话,我现在没环境也没法具体测试
header(" Content-type:image/ ");
$hostname = "localhost"; //MSSQL Server
$dbuser = "sa"; //用户名
$dbpasswd = "sa"; //密码
$database="library";
$conn = mssql_connect($hostname,$dbuser,$dbpasswd) or die("无法连接数据库服务器!");
mssql_select_db($database,$conn) or die("无法连接数据库$database");
$sql = "SELECT * FROM P_picimg where pid=9";
$result = @mssql_query($sql) or die("无法执行SQL:".$sql);
$row=mssql_fetch_array($result);
echo $row["pic1"];
//@header("Content-type: " . image_type_to_mime_type($row[pic1]));
mssql_close($conn);?>
你好,我的操作是php+sql server 2000
报错是怎么样?
报错是怎么样?我就是在一个页面显示,另外一张页面调用数据,没有报错哦~
程序就是上面的程序,显示页面为:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<table width="100%" border="0">
<tr>
<td><img border="0" src="test.php" ></td>
</tr>
</table>
</body>
</html>
补上你的图片类型 image_type_to_mime_type($row[pic1]);