Xtremer360 Posted September 22, 2008 Share Posted September 22, 2008 I have an image that isn't loading and I was hoping someone could tell me why? http://kansasoutlawwrestling.com/upcomingshow2.php <?php echo "<body bgcolor=\"black\" text=\"white\" link=\"red\" vlink=\"red\">"; require ('database.php'); print '<center><img src=/images/'.$row['showimage'].' height=125 width=500 border=1></center>'; //Define the query $query = "SELECT *, DATE_FORMAT(`date`, '%M %e, %Y') AS date FROM shows, matches WHERE matches.showid = shows.id ORDER BY matchid ASC"; if (($r = mysql_query ($query)) && mysql_num_rows ($r)){ // First row (for the date, location, and time) $row = mysql_fetch_array ($r); print '<center>Show Name: '.$row['showname'].'</center>'; print '<center>Date: '.$row['date'].'</center>'; print '<center>Location: '.$row['location'].'</center>'; print '<center>Bell Time: '.$row['belltime'].'</center><br><br>'; // Retrieve and print every record do { print '<center>'.$row['matchtype'].' Match</center>'; print '<center>'.$row['vs1'].' vs. '.$row['vs2'].'</center><br>'; } while ($row = mysql_fetch_array ($r)); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/ Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 $row['showimage'] is not defined, therefore there is no image to display. Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647411 Share on other sites More sharing options...
Xtremer360 Posted September 22, 2008 Author Share Posted September 22, 2008 Well with what else I have on the page to keep everything correct what do I need to do to define it then? Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647412 Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 What is in database.php? What is the image supposed to be? If it doesn't need to be changed, then replace: print '<center><img src=/images/'.$row['showimage'].' height=125 width=500 border=1></center>'; with print '<center><img src=/images/imagename.jpg height=125 width=500 border=1></center>'; Also, <center> tags shouldn't be used anymore, and you should really add quotes around your image source. Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647414 Share on other sites More sharing options...
Xtremer360 Posted September 22, 2008 Author Share Posted September 22, 2008 Only thing is its databased and different shows have different images so changing it to one image every time woudln't work. Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647415 Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 Please post your database.php code. Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647416 Share on other sites More sharing options...
Xtremer360 Posted September 22, 2008 Author Share Posted September 22, 2008 In that file is my DB login info that all. Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647417 Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 OK, you are not defining "$row['showimage']." You are using that as the variable that holds which image you want to use, but you are not telling the code what that variable should be. Judging by the fact that it is a "$row" variable, I'm guessing that you intended on grabbing the info from a database table, but you aren't selecting any data. To fix this, it's easy: DEFINE $row['showimage'] Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647418 Share on other sites More sharing options...
Xtremer360 Posted September 22, 2008 Author Share Posted September 22, 2008 What do I need to do to Define it? Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647420 Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 A static example would be: $row['showimage'] = "someimage.jpg"; A dynamic one would be: $query = "SELECT showimage FROM sometable WHERE somerow = 'somecondition'"; $result = mysql_query($query); $row = mysql_fetch_array($result); Quote Link to comment https://forums.phpfreaks.com/topic/125239-image-not-loading/#findComment-647421 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.