Hi all,
I am moving our site from a sub-directory (for testing purposes) to the root. And now, the images that were stored as longblobs in the mySQL database, do not work anymore?
Here is the page that works.
And here is the page that does not work.
Here is the code for both pages.
<html>
<head>
<? include('http://www.intheclassroom.org/noFrames/includes/header_Scripts.shtm'); ?>
<?PHP $conn = mysql_connect("x", "x", "x")
OR DIE (mysql_error());
@mysql_select_db ("inthecla_Main", $conn) OR DIE (mysql_error());
$prodID=$_GET['prodID'];
$prodType=$_GET['prodType'];
$sql = "SELECT prodGroup, prodName, prodDesc, prodDetails, prodType, prodTeacherRecc, prodColor, prodImgDim, prodLogo, prodImgAlt, ";
$sql.= "prodIsCC, prodRuntime, prodMetaDesc, prodMetaKeywords FROM tblProduct WHERE prodID=" . $prodID;
$result=@mysql_query($sql);
function wordwrapLine($s, $l) {
$tok = strtok($s, " ");
while (strlen($tok) != 0) {
if (strlen($line) + strlen($tok) < ($l + 2) ) {
$line .= " $tok";
}
else {
$formatted .= "$line\n";
$line = $tok;
}
$tok = strtok(" ");
}
$formatted .= $line;
$formatted = trim($formatted);
return $formatted;
}
?>
<title>Products Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../font.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="996" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="44">
<td width="952"> <table width="770" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<? include('../includes/header.php'); ?>
<tr>
<td class="font"></td>
<td class="font"> </td>
</tr>
<tr>
<td> </td>
<tr>
<td> </tr>
<tr>
<td> </td>
<td><img src="../images/vert_spacer.jpg" height="140"><br> <table width="933" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="196" align="center" valign="top">
<?PHP
$result = mysql_query("SELECT * FROM tblProduct WHERE prodID = '$prodID'") or exit(mysql_error());
if (mysql_num_rows($result))
{
$row = mysql_fetch_assoc($result);
echo '<img src="http://www.intheclassroom.org/noFrames/images/' . $row['prodLogo'] . '" Width="" Height="">';
}
else
{
echo 'no records matching that search criteria';
}
?>
<br> <br> <img src="../images/image.php?imgCat=product&prodID=<?PHP echo $prodID; ?>" alt="<?PHP echo mysql_result($result,0,'prodImgAlt'); ?>"><br>
<span class="font">
<?PHP
if (mysql_result($result,0,"prodType")=="1"){
echo 'Click the links below to view more samples<br>(must have "<a href="http://www.real.com">RealPlayer</a>)<br><br><hr><br><br>';
}
else
echo "";
?>
</span>
<?PHP $mediaSQL="SELECT mediaID, mediaName, mediaDesc, mediaPath, mediaImgDim FROM tblMedia";
$mediaSQL.=" WHERE mediaProdID=".$prodID." ORDER BY mediaDesc ASC";
$mediaResult=mysql_query($mediaSQL);
$i=0;
if ($mediaResult) {
?>
<div align="center" class="media">
<?PHP while ($row = mysql_fetch_array($mediaResult, MYSQL_ASSOC)) {
?>
<a href="<?PHP echo $row['mediaPath']; ?>"> <img src="../images/realPlayArrow.jpg" alt="play" width="25" height="18" />
<?PHP echo $row['mediaDesc']; ?></a><br>
<a href="<?PHP echo $row['mediaPath']; ?>"><?PHP echo $row['mediaName']; ?></a><br>
<a href="<?PHP echo $row['mediaPath']; ?>"><img src="../images/image.php?imgCat=media&mediaID=<?PHP echo $row['mediaID']; ?>"
<?PHP echo $row['mediaImgDim']; ?> alt="<?PHP echo $row['mediaName']; ?>"/></a><br>
<br>
<br>
<?PHP }
?>
</div>
<?PHP
}
?>
</td>
<td width="11"><img src="../images/vert_spacer.jpg" width="10" height="100"></td>
<td width="566"valign="top"> <span class="font">
<?PHP $sInput=wordwrapline(html_entity_decode(mysql_result($result,0,"prodDesc")),550);
$prodDesc=str_replace('</p><p>',"</p><p>\r\n",$sInput);
echo $prodDesc;
?>
</span> <span class="font">
<?PHP $s2Input=wordwrapline(html_entity_decode(mysql_result($result,0,"prodDetails")),550);
$prodDetails=str_replace('</p><p>',"</p><p>\r\n",$s2Input);
if (mysql_result($result,0,"prodDetails")!=""){
echo "<br><hr><br>".$prodDetails."<br><hr><br>";
}
?>
</span> <span class="font">
<?PHP $s3Input=wordwrapline(html_entity_decode(mysql_result($result,0,"prodTeacherRecc")),550);
$prodTeacherRecc=str_replace('</p><p>',"</p><p>\r\n",$s3Input);
if (mysql_result($result,0,"prodTeacherRecc")!=""){
echo $prodTeacherRecc."<br><br>";
}
?>
</span>
<?PHP
$sql2 = "Select prodName, prodID, prodType, prodGroup from tblProduct Where prodType=" . $prodType . " AND prodID !=". $prodID ." ORDER BY prodName ASC";
$result2 = mysql_query($sql2);
if ($prodType=="1") {
echo "<hr>";
while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
echo "<a href=\"http://www.intheclassroom.org/noFrames/products/product.php?prodID=".$row2['prodID']. "&prodType=".$row2['prodType']. "\">".$row2['prodName']."</a>";
echo "<br>";
}
}
?>
</td>
<td width="160" align="center" valign="top">
<?
$itemSQL="SELECT itemSKU, itemName, itemDesc, itemSort, itemType, itemWeight, itemTax, ";
$itemSQL.="itemFriendlyDesc, itemImgDim, itemPrice ";
$itemSQL.="FROM tblItems ";
$itemSQL.="WHERE ((itemProdID=".$prodID.") AND (itemEnabled=1)) ";
$itemSQL.="ORDER BY itemSort ASC";
$itemResult=mysql_query($itemSQL);
if ($itemResult) {
?>
<div class="items">
<?
while ($row=mysql_fetch_array($itemResult, MYSQL_ASSOC)) {
?>
<ul>
<img src="../images/image.php?imgCat=item&itemSKU=<? echo $row['itemSKU']; ?>"
<? echo $row['itemImgDim']; ?> alt="<? echo $row['itemDesc']?>" /> <span class="font"><? echo "<br>".$row['itemType']?></span>
<div class="stupidiehack">
<?
if ($row['itemDesc']=="Teaching Video"){
?>
<span class="runtime"> <span class="font">
<?
if (mysql_result($result,0,"prodRuntime")>0){
echo mysql_result($result,0,"prodRuntime"); ?>
</span> </span><span class="font">Min </span>
<? }
if (mysql_result($result,0,"prodIsCC")) { ?>
<img src="../images/cc_thumb.jpg"
width="20" height="14" alt="Closed Captioned" /><br />
<? }
}?>
<span class="font"><em>Price: </em></span><em><span class="money"><span class="font"><? echo $row['itemPrice']?></span></span></em>
</div>
<form action="http://www.ecartsoft.com/cgi-bin/cart.cgi" method="POST">
<input type="HIDDEN" name="acc" value="7728">
<input type="HIDDEN" name="page" value="add to cart">
<input type="HIDDEN" name="required" value="item_name,item_price">
<span class="font">QTY</span>:
<input name="quantity" type="TEXT" class="font" value="1" size="3">
<input type="HIDDEN" name="item_sku" value="<? echo $row['itemSKU']; ?>">
<input type="HIDDEN" name="item_name" value="<? echo $row['itemName']; ?>">
<input type="HIDDEN" name="item_description" value="<? echo $row['itemDesc']; ?>">
<input type="HIDDEN" name="item_price" value="<? echo $row['itemPrice']; ?>">
<input type="HIDDEN" name="item_weight" value="<? echo $row['itemWeight']; ?>">
<input type="HIDDEN" name="item_tax_id" value="<? echo $row['itemTax']; ?>">
<input type="HIDDEN" name="item_discount" value="">
<input type="HIDDEN" name="item_image_url" value="">
<br />
<span class="font">Coupon Code</span>:
<input type="TEXT" name="Coupon_Code" value="" size="10">
<input type="HIDDEN" name="secret_word" value="">
<input type="HIDDEN" name="ship_free" value="No">
<input type="HIDDEN" name="handling_fee" value="">
<br />
<input name="SUBMIT" type="SUBMIT" class="font" value="ADD TO CART">
<br>
<br>
<span class="font">
<?PHP $sInput=wordwrapline(html_entity_decode($row['itemFriendlyDesc']),175);
$sOutput=str_replace('<p>',"",$sInput);
$prodDesc=str_replace('</p>',"", $sOutput);
echo $prodDesc."<br />\r\n";
?>
</span> <br>
<img src="../images/HorizRule.jpg" width="100" height="7">
</form>
</ul>
<?
}
?>
</div>
<?
}
?>
</td>
</tr>
</table>
<? include ('http://www.intheclassroom.org/noFrames/includes/footer.php'); ?>
</td>
</tr>
</table>
</body>
</html>
I don't get it?
I tried to change all the paths to literal paths, and that did not resolve it either.
Thanks in advance.
Don