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="localhos t"; // 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(m ysql_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("SE LECT * FROM pix WHERE location='$loca tionval'");
if ($row = mysql_fetch_ass oc($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='multip art/form-data' action='uploade r.php' method='post'>
<input type='hidden' name='MAX_FILE_ SIZE' value='150000'>
<input type='hidden' name='completed ' value='submitte d'>
<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='multip art/form-data' action='uploade r.php' method='post'>
<input type='hidden' name='MAX_FILE_ SIZE' value='150000'>
<input type='hidden' name='completed ' value='submitte d'>
<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="localhos t"; // 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(m ysql_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("SE LECT * FROM pix WHERE location='$loca tionval'");
$in = 'not in';
if ($imgrow = mysql_fetch_ass oc($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%"><im g src="../images/image1.jpg"></td>
<td colspan="2">
<form action="scripts/update.php" method="post">
<input type='text' name='hometxt1t itle'>
<input type="text" name='hometxt1a uthor'>
<textarea name='hometxt1t xt' rows='5' cols="70">
<?
$result=mysql_q uery("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='multip art/form-data' action='uploade r.php' method='post'>
<input type='hidden' name='MAX_FILE_ SIZE' value='150000'>
<input type='hidden' name='completed ' value='submitte d'>
<input type='file' name='imagefile '>
<input type="hidden" name="location" value="home1">< br>
<input type='submit'>
</form>
</td>
<td width="25%"><im g 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
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="localhos t"; // 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(m ysql_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("SE LECT * FROM pix WHERE location='$loca tionval'");
if ($row = mysql_fetch_ass oc($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='multip art/form-data' action='uploade r.php' method='post'>
<input type='hidden' name='MAX_FILE_ SIZE' value='150000'>
<input type='hidden' name='completed ' value='submitte d'>
<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='multip art/form-data' action='uploade r.php' method='post'>
<input type='hidden' name='MAX_FILE_ SIZE' value='150000'>
<input type='hidden' name='completed ' value='submitte d'>
<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="localhos t"; // 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(m ysql_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("SE LECT * FROM pix WHERE location='$loca tionval'");
$in = 'not in';
if ($imgrow = mysql_fetch_ass oc($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%"><im g src="../images/image1.jpg"></td>
<td colspan="2">
<form action="scripts/update.php" method="post">
<input type='text' name='hometxt1t itle'>
<input type="text" name='hometxt1a uthor'>
<textarea name='hometxt1t xt' rows='5' cols="70">
<?
$result=mysql_q uery("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='multip art/form-data' action='uploade r.php' method='post'>
<input type='hidden' name='MAX_FILE_ SIZE' value='150000'>
<input type='hidden' name='completed ' value='submitte d'>
<input type='file' name='imagefile '>
<input type="hidden" name="location" value="home1">< br>
<input type='submit'>
</form>
</td>
<td width="25%"><im g 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
Comment