hi all
i have a problem i have a script that i got working exactly the way i wanted it. and then i tried to intrigate it into the site and it totaly stopped working. below is the original code
[PHP]
<?
$host="localhost"; // Host name.
$db_user="****"; // MySQL username.
$db_password="*******"; // MySQL password.
$database="cms"; // Database name.
$cms = mysql_pconnect($host, $db_user, $db_password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $cms);
$errmsg="";
// If this is the image request, send out the image
$page = "home";
$position = $_REQUEST[gim];
$locationval = $page . $position;
$gotten = mysql_query("SELECT * FROM pix WHERE location='$locationval'");
if ($row = mysql_fetch_assoc($gotten))
{
$bytes = $row[imgdata];
header("Content-type: image/jpeg");
print $bytes;
exit ();
}
?>
<html><head>
<title>Upload image</title>
<table>
<tr>
<td><img src=?gim=1 width="144" /></td>
</tr>
<tr>
<td>
<form enctype='multipart/form-data' action='uploader.php' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='150000'>
<input type='hidden' name='completed' value='submitted'>
<input type='file' name='imagefile'>
<input type="hidden" name="location" value="home1"><br>
<input type='submit'>
</form>
</td>
</tr>
<tr>
<td><img src=?gim=2 width=144></td>
</tr>
<tr>
<td>
<form enctype='multipart/form-data' action='uploader.php' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='150000'>
<input type='hidden' name='completed' value='submitted'>
<input type='file' name='imagefile'><br>
<input type="hidden" name="location" value="home2"><br>
<input type='submit' value="submit">
</form>
</td>
</tr>
</table>
</body>
</html>
[/PHP]
ok so the basic thought behind this is i send the number with my image tag and then that concatinates that with the name of the page and searches for the image that belongs with that location. so prety simple, the above script works but the one below one has just a small peice of php in addition to the rest of code above. but there is apparently some conflict that i cannot figure out.
[PHP]
<?
$host="localhost"; // Host name.
$db_user="****"; // MySQL username.
$db_password="*******"; // MySQL password.
$database="cms"; // Database name.
$cms = mysql_pconnect($host, $db_user, $db_password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $cms);
$errmsg="";
// If this is the image request, send out the image
$page = "home";
$position = $_REQUEST[gim];
$locationval = $page . $position;
$gotten = mysql_query("SELECT * FROM pix WHERE location='$locationval'");
$in = 'not in';
if ($imgrow = mysql_fetch_assoc($gotten))
{
$bytes = $imgrow[imgdata];
header("Content-type: image/jpeg");
$in = 'in';
print $bytes;
exit ();
}
?>
</head>
<body>
<img src=?gim=1 width="144">
<table width='650' border='1'>
<tr>
<td><img src="images/header.jpg" width="650" height="88"></td>
</tr>
<tr>
<td>
<table width="100%" border='1'>
<tr>
<td width="25%"><img src="../images/image1.jpg"></td>
<td colspan="2">
<form action="scripts/update.php" method="post">
<input type='text' name='hometxt1title'>
<input type="text" name='hometxt1author'>
<textarea name='hometxt1txt' rows='5' cols="70">
<?
$result=mysql_query("SELECT id, title, author, article, location FROM atricles");
$row=mysql_num_rows($result);
$row2 = mysql_fetch_row($result);
echo $row2[3];
?>
</textarea>
<input type="hidden" name='location' value='home1'>
<br />
<input type="submit">
</form>
</td>
</tr>
<tr>
<td colspan="2">
<img src=?gim=1 width="144"><br>
<form enctype='multipart/form-data' action='uploader.php' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='150000'>
<input type='hidden' name='completed' value='submitted'>
<input type='file' name='imagefile'>
<input type="hidden" name="location" value="home1"><br>
<input type='submit'>
</form>
</td>
<td width="25%"><img src="../images/image3.jpg"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="images/footer.jpg" width="650" height="125"></td>
</tr>
</table>
<?
echo $in, '<br>', $page, '<br>', $position, '<br>', $locationval;
?>
</body>
</html>
[/PHP]
and because of my tests i know that i am not getting into my if statement
thanks
eric