I need some help I have a page "show.php" that I use to display the profile image of my subscribers. It gets the subscriber_id from the insert.php page and then retrieves the "subscriber_profile_image" from the database and table "subscriber_info" and then sends the image back to the insert.php page where it is viewed on the page. Now this all works perfectly but I have images in other tables eg: "administrator_info" in the column "admin_profile_image". But I need to know how to write the script to allow me to view images from the different tables all from the same show.php page, or do I have to create a show page for ever table?eg show_subscriber_image.php and then show_administrator_image.php.
The way I have it at the moment I can only display the subscriber image I know there is something not right aim just not sure what it is!
here is the script I have for the insert.php page that request and then displays the "subscriber_profile_image" and "administrator_profile_image".
<html> <body> <img src="show.php?subscriber_id=<?php echo $_POST['subscriber_id']; ?>" /> </body> </html>& then below that is
<html> <body> <img src="show.php?admin_id=<?php echo $_POST['admin_id']; ?>" /> </body> </html>
show.php script
<?php
$username = "";
$password = "";
$host = "localhost";
$database = "the_secrets_out";
$table = "subscriber_info";
$column = "subscriber_profile _image";
$sort = "subscriber_id";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$id = $_GET[$sort];
if(!isset($id) || empty($id)){
die("Please select your image!");
}else{
$query = mysql_query("SELECT * FROM $table WHERE $sort='".$id."'");
$row = mysql_fetch_array($query);
$content = $row[$column];
header('Content-type: image/jpg');
echo $content;
}
?>
<?php
$username = "";
$password = "";
$host = "localhost";
$database = "the_secrets_out";
$table = "administrator_info";
$column = "administrator_profile_image";
$sort = "admin_id";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$id = $_GET[$sort];
if(!isset($id) || empty($id)){
die("Please select your image!");
}else{
$query = mysql_query("SELECT * FROM $table WHERE $sort='".$id."'");
$row = mysql_fetch_array($query);
$content = $row[$column];
header('Content-type: image/jpg');
echo $content;
}
?>
any help is greatly appreciated!
Edited by Orjan, 07 February 2011 - 04:05 AM.
Please use [php]-tags when posting php code


Sign In
Create Account


Back to top









