Hello,
The images are not getting displayed at all in the following 2 pages. In both the pages a rectangle with the alt text is appearing. In new_release.php, the links are working fine. Does anyone know what could be wrong?
new_release.php
<body>
<div class="new_releases">
[code=php]<?php
include("db.php");
$cxn = @ConnectToDb($server, $user, $pass, $database);
$sql = "select ISBN, title, price, author, publisher, date_format( pub_date, '%d %M %Y' ) as f_pub_date " .
"from books where MONTH(pub_date)= MONTH(CURRENT_DATE) and YEAR(pub_date) = YEAR(CURRENT_DATE) ".
"order by f_pub_date desc";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result)>0)
{
while ($row = mysql_fetch_array($result)){
$title_str = trim(strtolower($row["title"]));
disp_book_cover_image($title_str);
}
}
function disp_book_cover_image($title_str){
$sp_char_arr = array("/","'",",");
$temp_title_str = str_replace($sp_char_arr,"",$title_str);
$sp_char_arr = array("&"," ");
$new_title_str = str_replace($sp_char_arr,"_",$temp_title_str);
$name='book_desc.php?title='.$title_str;
$fileName = 'c:/bookstore/books_thumbnail/'.$new_title_str.'_sm'.'.jpg';
echo $fileName;
if (file_exists($fileName))
{
echo '<a href="'.$name.'"><img src="'.$fileName.'" alt="'.$title_str.'"/><a>';
}
else
{$fileName = 'c:/bookstore/books_thumbnail/'.$new_title_str.'_sm'.'.gif';
if(file_exists($fileName)){
echo '<a href="'.$name.'"><img src="'.$fileName.'" alt="'.$title_str.'"/><a>';
}
}
}//end function*/
?>
</div>
</body>[/code]
book_desc.php
<body>
[code=php]<?php
session_start();
include("db.php");
// Get a connection to the database
$cxn = @ConnectToDb($server, $user, $pass, $database);
if (isset ($_GET["title"]))
create_select($_GET["title"]);
else
echo "ERROR";
function create_select($title){
$_SESSION["title"]=$title;
/*$sql="select * from books where title='".$_SESSION['title']."'";*/
$sql="select ISBN, title, price, author, publisher, book_desc, date_format( pub_date, '%d %M %Y' ) as f_pub_date ".
"from books where title='".addslashes($_SESSION['title'])."'";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result)==1)
{while ($row = mysql_fetch_array($result))
{
print '<div class="book_desc_main">'; /*main div*/
print '<div class="book_cover">';
$title_str = trim(strtolower($row["title"]));
disp_book_cover_image($title_str);
print '</div>';/*div book_cover*/
print '<div class="book_title">' .$row["title"]. '</div>';
print '<div class="author">' .$row["author"]. '</div>';
print '<div class="book_details">ISBN:' .$row["ISBN"]. '<br>
Price: Rs '.$row["price"]. '<br>
Publisher: '.$row["publisher"]. '<br>
Pub Date: '.$row["f_pub_date"]. '<br>
Description: '.$row["book_desc"]. '<br></div><br><br>';
?>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="33">
<param name="movie" value="button1.swf" />
<param name="quality" value="high" />
<embed src="button1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="33" ></embed>
</object>
<?php
print '</div>'; /*main div*/
}//END WHILE LOOP
}//END IF STMT
else
{
print 'ERROR';
}
}//end func create_select
function disp_book_cover_image($title_str){
$sp_char_arr = array("/","'",",");
$temp_title_str = str_replace($sp_char_arr,"",$title_str);
$sp_char_arr = array("&"," ");
$new_title_str = str_replace($sp_char_arr,"_",$temp_title_str);
$fileName = 'c:/bookstore/images/'.$new_title_str.'.jpg';
if(file_exists($fileName))
print "<img src='".$fileName."' alt='".$title_str."' vspace=5/>";
else
{$fileName = 'c:/bookstore/images/'.$title_str.'.gif';
if(file_exists($fileName))
print "<img src='".$fileName."' alt='".$title_str."' vspace=5/>";
}
}//end function
?>
</body>[/code]
thank you in advance