I'm a noob, I know very little about php. Anyway, my page won't load at all, browser says its redirecting in a way that is not loading. As the title suggests I think the issue is with one of the php files I include with require_once(). Let me just show you:
thumbnail.php:
<?php
if(!function_exists("makethumbnail"))
{
//die("right before function definition");
function makethumbnail($src,$new_name,$new_width,$new_height)
{
die("inside makethumbnail");
$si = imagecreatefromjpeg($src);
$w = imagesx($si);
$h = imagesy($si);
$vi = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($vi,$si,0,0,0,0,$new_width,$new_height,$w,$h);
imagejpeg($vi,$new_name);
}
}
?>
index.php:
<?php
require_once("shopsite/thumbnail.php");
require_once("shopsite/checksession.php");
die("made it past the require_once");
$con = mysql_connect('localhost','jddancks','csc255');
mysql_select_db('test',$con);
$q = mysql_query("select prod_name,image_name,type1,type2 from Product",$con) or die("its the mysql");
$row = mysql_fetch_assoc($q);
$totalRows_Recordset1 = mysql_num_rows($q);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Welcome to the shopsite</title>
<script type="text/javascript" src="shopsite/lib/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="shopsite/lib/jquery.jcarousel.min.js"></script>
<link rel="stylesheet" type="text/css" href="shopsite/skins/ie7/skin.css" />
<script type="text/javascript">
JQuery(document).ready(function() {
JQuery('#mycarousel').jcarousel({
itemLoadCallback:itemLoadCallbackFunction,
start:1,
auto:3,
animation:"slow",
wrap:"both"
});
});
</script>
</head>
<body>
<?php
session_start();
if(isset($_SESSION['nick']))
{
echo "<p>Welcome, ".$_SESSION['nick']."</p>";
}
die("Made it past the first php");
?>
<h1>Welcome to the one-stop shop for your every need!</h1>
<div class="jcarousel-ie7">
<p>Browse Items:</p>
<div class="jcarousel-container">
<div class="jcarousel-clip">
<ul id="mycarousel" class="jcarousel-skin-ie7">
<?php
$cnt=1;
do
{
$i=$row['image_name'];
$name=preg_split("/.jpg/",$i);
$name = "shopsite/thumb/".$name[0]."-index.jpg";
if(!file_exists($name))
{
makethumbnail("shopsite/images/".$row['image_name'],$name,50,50);
}
echo " <li class=\"jcarousel-item-".$cnt."\"><img src=\"".$name."\" /></li>\n";
$cnt=$cnt+1;
if($cnt>12) die("cnt larger than 12");
}
while($row = mysql_fetch_assoc($q));
?>
</ul>
</div>
<div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
<div class="jcarousel-next"></div>
</div>
</div>
</body>
</html>
<?php mysql_free_result($row);
mysql_close($con); ?>
I want to insert images into a jquery carousel so a visitor can browse items they may want to purchase. I've never used jcarousel so I don't know if what I have works, I'm pretty sure thats not the problem. I guess its just one f those things you need a second pair of eyes for. The die statements in thumbnail.php make me believe that is the culprit, but it won't make it to the first line of the function, which is really confusing. I don't know how the php preporcessor works, other than its client-side.