我的画廊存在问题。我的网址是数字我需要改为混合数字和单词。我在$fid = $_GET['name'];
之前更改了$_GET['id']
,现在图像没有显示。怎么办?
Mysql表:
CREATE TABLE IF NOT EXISTS `gallery` (
`id` int(12) NOT NULL,
`link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`des` text COLLATE utf8_unicode_ci NOT NULL,
`fid` int(12) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
PHP代码:
<?php
$fid = mysql_real_escape_string($_GET["name"]);
$book= mysql_query("SELECT * from books WHERE id='$fid'") or die(mysql_error());
if(mysql_num_rows($books) != 0) {
$row = mysql_fetch_array($books);
?>
<?php
$fid = $_GET['name'];
$gallery = mysql_query("SELECT * FROM gallery WHERE id='$fid'") or die (mysql_error());
while($gal = mysql_fetch_array($gallery)){
$linkgal = $gal['link'];
$title = $gal['title'];
$id = $gal['id'];
$fid = $gal['fid'];
echo "'<img src='/uploads/gallery/$linkgal' title='$title' alt='$title' style='height:180px; margin-left:23px;cursor: pointer;'";
echo 'onclick="PopupCenter';
echo "('/photos.php?fid=$fid&id=$id', 'xtf', '990', '670')";
echo '"/>';
}
?>
答案 0 :(得分:1)
好的我已经完成了。我已经添加了数组和$ _GET.Now它的工作原理。 实际上它是打开另一个窗口,图像在那里。如何使用像这样的jquery:http://www.1stwebdesigner.com/wp-content/uploads/2010/01/jquery-gallery-solutions/galleria-jquery-image-slideshow-tools-free.jpg
<?php
> $id = $_GET['name'];
> $book = mysql_query("SELECT * FROM `books` WHERE `name`='$id'") or die (mysql_error());
> $books = mysql_fetch_array($book);
> $id = $book['id'];
> $name = $book['name'];
$gallery = mysql_query("SELECT * FROM `gallery` WHERE `fid`='$id' ORDER BY `id`") or die (mysql_error());
while($gal = mysql_fetch_array($gallery)){
$linkgal = $gallink'];
$title = $gal['title'];
$id = $gal['id'];
$fid = $gal['fid'];
echo "'<img src='/uploads/gallery/$linkgal' title='$title' alt='$title' style='height:180px; margin-left:23px;cursor: pointer;'";
echo 'onclick="PopupCenter';
echo "('/photos.php?fid=$fid&id=$id', 'xtf', '990', '670')";
echo '"/>';
}
echo '</div>';
?>