検索結果の画像が表示されない
<?php
$con=mysql_connect("");
if(!$con){
echo ("MYSQLに接続失敗");
exit();
}
else
{
echo ("#1=$con");
}
mysql_query("SET NAMES eucjpms") or die("can not SET NAMES eucjpms");
$db=mysql_select_db("");
if(!$db) {
echo ("DB選択失敗");
}
else{
echo("DB選択OK!");
}
$jyusyo=$_POST["jyusyo"];
$jyusyonum=array("豊岡市","養父市","朝来市","神戸市","姫路市");
$query = "select name,jyusyo,kakaku,gazou from ocdda where";
if($jyusyo != "") {
$query = $query . " jyusyo like '%$jyusyo%' ";
}
$result = mysql_query($query);
$num_rows=mysql_num_rows($result);
if($num_rows== 0){
$message="該当データ無し";
}
else $message=$num_rows ."件あります";
echo $message;
while($row = mysql_fetch_array($result)){
// Loop through the array of score data, formatting it as HTML
echo '<table>';
$i = 0;
{
// Display the score data
echo '<tr><td class="scoreinfo">';
echo '<span class="kakaku">' . $row['kakaku'] . '</span><br />';
echo '<strong>会社名:</strong> ' . $row['name'] . '<br />';
echo '<strong>住所:</strong> ' . $row['jyusyo'] . '</td>';
if (is_file(GW_UPLOADPATH . $row['gazou']) && filesize(GW_UPLOADPATH . $row['gazou']) > 0) {
echo '<td><img src="' . GW_UPLOADPATH . $row['gazou'] . '" alt="images" /></td></tr>';
}
else {
echo '<td><img src="' . GW_UPLOADPATH . 'ie.jpg' . '" alt="images" /></td></tr>';
}
$i++;
}
echo '</table>';
mysqli_close($dbc);
?>
<?php } ?>
こちらでは表示されないのですが、
<?php
require_once('appvars.php');
require_once('connectvars.php');
// Connect to the database
$dbc = mysqli_connect("");
// Retrieve the score data from MySQL
$query = "SELECT * FROM ";
$data = mysqli_query($dbc, $query);
// Loop through the array of score data, formatting it as HTML
echo '<table>';
$i = 0;
while ($row = mysqli_fetch_array($data)) {
// Display the score data
echo '<tr><td class="scoreinfo">';
echo '<span class="kakaku">' . $row['kakaku'] . '</span><br />';
echo '<strong>会社名:</strong> ' . $row['name'] . '<br />';
echo '<strong>住所:</strong> ' . $row['jyusyo'] . '</td>';
if (is_file(GW_UPLOADPATH . $row['gazou']) && filesize(GW_UPLOADPATH . $row['gazou']) > 0) {
echo '<td><img src="' . GW_UPLOADPATH . $row['gazou'] . '" alt="image" /></td></tr>';
}
else {
echo '<td><img src="' . GW_UPLOADPATH . 'unverified.gif' . '" alt="Unverified kakaku" /></td></tr>';
}
$i++;
}
echo '</table>';
mysqli_close($dbc);
?>
こちらでは画像が表示されます。同じ階層でほぼ同じソースなのに何故前者のコードは画像が表示されないのでしょうか?