PHP MYSQL基本问题,如果查询为空,则隐藏图像
我问了一个基本问题。我查询并回显图像。在我的代码中,如果“PHP MYSQL基本问题,如果查询为空,则隐藏图像,php,mysql,sql,Php,Mysql,Sql,我问了一个基本问题。我查询并回显图像。在我的代码中,如果“”.$row['image'].为空,它将在浏览器中显示一个小的红十字图像。如果查询为空,如何隐藏图像 $result = mysql_query("SELECT * FROM table WHERE catalog='image'"); while ($row = mysql_fetch_array($result)) { echo '<img src="'.$row['image'].'" />'; } if(!emp
”.$row['image'].
为空,它将在浏览器中显示一个小的红十字图像。如果查询为空,如何隐藏图像
$result = mysql_query("SELECT * FROM table WHERE catalog='image'");
while ($row = mysql_fetch_array($result))
{
echo '<img src="'.$row['image'].'" />';
}
if(!empty($row['image'])){
echo '<img src="'.$row['image'].'" />';
}
$result=mysql\u查询(“从catalog='image'所在的表中选择*);
while($row=mysql\u fetch\u数组($result))
{
回声';
}
为什么不检查$row['image']
是否为空
$result = mysql_query("SELECT * FROM table WHERE catalog='image'");
while ($row = mysql_fetch_array($result))
{
echo '<img src="'.$row['image'].'" />';
}
if(!empty($row['image'])){
echo '<img src="'.$row['image'].'" />';
}
if(!empty($row['image'])){
回声';
}
为什么不检查$row['image']
是否为空
$result = mysql_query("SELECT * FROM table WHERE catalog='image'");
while ($row = mysql_fetch_array($result))
{
echo '<img src="'.$row['image'].'" />';
}
if(!empty($row['image'])){
echo '<img src="'.$row['image'].'" />';
}
if(!empty($row['image'])){
回声';
}
$result=mysql\u查询(“从catalog='image'所在的表中选择*);
while($row=mysql\u fetch\u数组($result))
{
如果(修剪($row['image'])!=“”)
回声';
}
$result=mysql\u查询(“从catalog='image'所在的表中选择*);
while($row=mysql\u fetch\u数组($result))
{
如果(修剪($row['image'])!=“”)
回声';
}
$result=mysql\u查询(“从catalog='image'所在的表中选择*);
while($row=mysql\u fetch\u数组($result))
{
如果(!empty($row['image'])){
回声';
}
}
$result=mysql\u查询(“从catalog='image'所在的表中选择*);
while($row=mysql\u fetch\u数组($result))
{
如果(!empty($row['image'])){
回声';
}
}
谢谢大家,所有答案对我都有用,我接受第一个答案帖子的正确答案。谢谢大家,所有答案对我都有用,我接受第一个答案帖子的正确答案。