我创建图像滑块。它必须使用用户名和密码才能运行。这是。
<?
include 'connect.php';
$_session[user_login] = "zyxel";
$_session[pass_login] = "12345";
?>
<html>
<head>
<link rel="stylesheet" href="themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="themes/light/light.css" type="text/css" media="screen" />
<link rel="stylesheet" href="themes/dark/dark.css" type="text/css" media="screen" />
<link rel="stylesheet" href="lib/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="lib/style.css" type="text/css" media="screen" />
</head>
<body>
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<?php
$sql1 = "SELECT gload1,gload2,gload3,gload4,gload5 FROM member WHERE $_session[user_login] AND $_session[pass_login]";
$result1 = mysql_query($sql1);
$arry1 = mysql_fetch_array($result1);
$a = 0;
$b = 1;
$c = 2;
$d = 3;
$e = 4;
$f = 5;
$g = 6;
$h = 7;
$i = 8;
$j = 9;
if(empty($arry1)){
exit();
}
else {
$index = array_search(max($arry1),$arry1);
if($index == $a){
echo "<img src=images/01/01.jpg>";
echo "<img src=images/01/02.jpg>";
echo "<img src=images/01/03.jpg>";
echo "<img src=images/01/04.jpg>";
}else if($index == $b){
echo "<img src=images/02/01.jpg>";
echo "<img src=images/02/02.jpg>";
echo "<img src=images/03/03.jpg>";
echo "<img src=images/04/04.jpg>";
}else if($index == $c){
echo "<img src=images/03/01.jpg>";
echo "<img src=images/03/02.jpg>";
echo "<img src=images/03/03.jpg>";
echo "<img src=images/03/04.jpg>";
}else if($index == $d){
echo "<img src=images/04/01.jpg>";
echo "<img src=images/04/02.jpg>";
echo "<img src=images/04/03.jpg>";
echo "<img src=images/04/04.jpg>";
}else {exit();
}
?>
</body>
</html>
错误是:警告:mysql_fetch_array():提供的参数不是第 21 行中的有效 MySQL 结果资源 [$arry1 = mysql_fetch_array($result1);]
我知道问题出在 SQL 中!在此之前,我使用 [SELECT .... FROM member WHERE mid = '001';] 并且它只是显示出来。 我该如何解决。
感谢您的任何回答。