如何在只有一次PHP时放入文本

时间:2015-12-03 09:31:49

标签: php fancybox image-gallery

我有一个带边框的花式框图片库,如果奇数边框底部,每个图像都有边框顶部,如下所示:

enter image description here

最厚的边界在哪里应该是文字。

我有这个代码到图像中的每个图片



<?php
	$con = mysqli_connect("localhost","root","","gibellino");
	mysqli_set_charset($con,"utf-8");
	$result = mysqli_query($con, "select * from imper");
					
	$first = 'first';
					
	while($row = mysqli_fetch_array($result)){
		$img = $row['img'];
		echo "<a href='imagem/bd/imper/$img' rel='imper' title='$img'><img src='imagem/bd/imper/$img' alt='' id='$first'><span></span></a>";
		$first = '';
	}
	echo "<h4>Impermeabilização</h4>";
	mysqli_close($con);
?>
&#13;
&#13;
&#13;

所有图片都来自数据库。但正如你所看到的那样,没有文字,我也不知道问题是什么。有人和fancybox合作过吗?有这个问题吗?

1 个答案:

答案 0 :(得分:1)

如果您从同一个数据库中获取文本,而您从$img获取文本,则还可以在while循环中包含与您的图像相关联的文本。像这样......

<?php
	$con = mysqli_connect("localhost","root","","gibellino");
	mysqli_set_charset($con,"utf-8");
	$result = mysqli_query($con, "select * from imper");
					
	$first = 'first';
					
	while($row = mysqli_fetch_array($result)){
		$img = $row['img'];
		echo "<a href='imagem/bd/imper/$img' rel='imper' title='$img'><img src='imagem/bd/imper/$img' alt='' id='$first'><span>$some_text</span></a>";
		$first = '';
	}
	echo "<h4>Impermeabilização</h4>";
	mysqli_close($con);
?>