php数据库图片循环代码 php处理图片的库
PHP照片循环显示问题,如何用AJAX循环显示上一张下一张照片
兄弟,你要注意区分好php和JS的区别啊。帮你搞定了。
成都创新互联是专业的昆都仑网站建设公司,昆都仑接单;提供网站设计、成都做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行昆都仑网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
//wp_442057835.php
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head
titleAjax Get Picture/title
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
meta http-equiv="Content-Language" content="zh-CN" /
/head
body
script
function last_pic() {
userid = document.getElementById("user_pic").getAttribute("imgid"); //使用imgid存储当前照片搜携id
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Browser does not support HTTP Request");
return null;
}
var q="1";
var url="wp_442057835_process.php?q="+q+"u=弯漏棚"+userid+"sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function next_pic() {
userid = document.getElementById("user_pic").getAttribute("imgid");
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Browser does not support HTTP Request");
return null;
}
var q="2";
var url="wp_442057835_process.php?q="+q+"u="+userid+"sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
var nuserid=xmlHttp.responseText;
var newImage = document.getElementById("user_pic");
newImage.setAttribute("src", "user_pic/"+nuserid+".jpg");
newImage.setAttribute("imgid", nuserid);
}
}
function GetXmlHttpObject(){
var request;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
var arrVersions = ["Microsoft.XMLHTTP","MSXML2.XMLHttp.4.0",
"MSXML2.XMLHttp.3.0","MSXML2.XMLHttp.5.0"];
for(var i=0;i arrVersions.length;i++){
try{
request = new ActiveXObject(arrVersions[i]);
return request;
}catch(exception){
//忽略,埋则继续
}
}
}else{
request = new XMLHttpRequest();
return request;
}
}
/script
div id="pic_show"
a href="javascript:;" onclick="last_pic(); return false;" 上一张/a
img src="?php echo "user_pic/1.jpg" ?" alt="修改头像" hspace="7" id="user_pic" width="200px" height="100px" imgid="1"/
a href="javascript:;" onclick="next_pic(); return false;" 下一张/a
/body
/html
//wp_442057835_process.php
?php
header("content-type:textml;charset=utf-8");
include("db.php");
//echo $_GET["q"];
//echo $_GET["u"];
$userid=$_GET["u"];
if($_GET["q"]==1)
{
$lquery=mysql_query("SELECT * FROM usermember WHERE userid $userid ORDER BY userid DESC LIMIT 1 ");
$last_user =mysql_fetch_object($lquery);
$last_userid=$last_user-userid;
if(empty($last_userid)) $last_userid = $userid;
echo $last_userid;
}
if($_GET["q"]=="2")
{
$nquery=mysql_query("SELECT * FROM usermember WHERE userid $userid ORDER BY userid ASC LIMIT 1 ");
$next_user =mysql_fetch_object($nquery);
$next_userid=$next_user-userid;
if(empty($next_userid)) $next_userid = $userid;
echo $next_userid;
}
PHP循环输出数据库的图片和名称
style='width:60px;float:$f;' 这里者型的郑租$f变量喊嫌兆放在单引号中,php不是解析不了吗?把$f拿出来然后拼接一下吧, style='width:60px;float:‘“.$f.";
求教php首页上想让两张图片循环滚动代码怎么写啊
可以使用flexslider ,代码和下边类山卜似
div class="slider"
div class="flexslider flexslider2"
ul class="slides item"
?php foreach($slide as $v) { ?
lia target="_bland" href="?php echo $v['Url']; ?"逗物穗img src="蚂悄?php echo '../'.$v['ImagePath']; ?" width="960" height="250"/a/li
?php } ?
/ul
/div
/div
网页题目:php数据库图片循环代码 php处理图片的库
本文网址:http://scyanting.com/article/ddpcpih.html