我通过从数据库中提取图像来完成一个图库页面。现在我必须在该页面中查看特定图像。为此,我需要为要查看的特定图像设置id。通过id查看图像的代码是什么?
<!doctype html>
<!--[if IE 7 ]> <html lang="en-gb" class="isie ie7 oldie no-js"> <![endif]-->
<!--[if IE 8 ]> <html lang="en-gb" class="isie ie8 oldie no-js"> <![endif]-->
<!--[if IE 9 ]> <html lang="en-gb" class="isie ie9 no-js"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en-gb" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Image Dental Clinic</title>
<meta name="description" content="">
<meta name="author" content="">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- **Favicon** -->
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<!-- **CSS - stylesheets** -->
<link id="default-css" href="style.css" rel="stylesheet" media="all" />
<link id="shortcodes-css" href="shortcodes.css" rel="stylesheet" media="all" />
<link id="skin-css" href="skins/green/style.css" rel="stylesheet" media="all" />
<link id="fancy-box" href="css/jquery.fancybox.css" rel="stylesheet" media="all" />
<link href="css/prettyPhoto.css" rel="stylesheet" media="all" />
<!-- **Additional - stylesheets** -->
<link href="css/responsive.css" rel="stylesheet" media="all" />
<link href="css/pace-theme-loading-bar.css" rel="stylesheet" media="all" />
<!-- **Font Awesome** -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/flaticon.css">
<!-- **Google - Fonts** -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,300,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:400,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Crete+Round' rel='stylesheet' type='text/css'>
<!-- **Modernizr** -->
<script src="js/modernizr.custom.js"></script>
<script type="text/javascript">
var mytheme_urls = {
stickynav : 'enable'
};
</script>
</head>
<body>
<!--<div id="loader-wrapper">
<div class="loader">
<span class="glyph-icon flaticon-man159"></span>
</div>
</div>-->
<!-- **Wrapper** -->
<div class="wrapper">
<div class="inner-wrapper">
<!-- header-wrapper starts here -->
<div id="header-wrapper">
<header id="header">
<!-- Top bar starts here -->
<div class="top-bar">
<div class="container">
<div class="dt-sc-contact-info">
<p><i class="fa fa-phone"></i>Any Questions? Call Us: <span>966 1 4836060</span></p>
</div>
<!-- <div class="top-right">
<ul>
<li><a title="Login" href="login.html"><span class="fa fa-sign-in"></span>Member Login</a></li>
<li><a title="Register Now" href="register.html"><span class="fa fa-user"></span> Register </a></li>
</ul>
</div>-->
</div>
</div>
<!-- Top bar ends here -->
<div class="main-menu-container">
<div class="main-menu">
<div id="logo"> <a title="Travel" href="index.html"><img title="Fitness" alt="Fitness" src="images/logo.png"></a> </div>
<div id="primary-menu">
<div class="dt-menu-toggle" id="dt-menu-toggle">Menu<span class="dt-menu-toggle-icon"></span></div>
<nav id="main-menu">
<ul id="menu-main-menu" class="menu">
<li class="menu-item-simple-parent menu-item-depth-0"><a href="index.php">Home</a> </li>
<li class="menu-item-megamenu-parent megamenu-4-columns-group menu-item-depth-0"> <a href="about.php">About Us</a>
</li>
<li class="menu-item-simple-parent menu-item-depth-0"><a href="service.php">Our Services </a>
<ul class="sub-menu">
<li> <a href="cosmetic_dentistry.php">Cosmetic Dentistry </span> </span> </a> </li>
<li> <a href="dental_implant.php">Dental Implants </span> </span> </a> </li>
<li> <a href="periodontal_care.php">Periodontal Care</span> </span> </a> </li>
<li> <a href="endodontic_treatment.php">Endodontic Treatment </span> </span> </a> </li>
<li> <a href="pediatric_dentistry.php">Pediatric Dentistry </span> </span> </a> </li>
<li> <a href="orthodontics.php">Orthodontics </span> </span> </a> </li>
<li> <a href="restorative_dentistry.php">Restorative Dentistry </span> </span> </a> </li>
</ul>
<a class="dt-menu-expand">+</a> </li>
<li class="menu-item-megamenu-parent megamenu-4-columns-group menu-item-depth-0"> <a href="doctors.php" title="">Doctors</a> </li>
<li class="menu-item-megamenu-parent megamenu-4-columns-group menu-item-depth-0"> <a href="appoinment.php" title="">Appoinment</a> </li>
<li class="current_page_item menu-item-megamenu-parent megamenu-4-columns-group menu-item-depth-0"> <a href="gallery.php" title=""> Gallery </a> </li>
<li class="menu-item-simple-parent menu-item-depth-0"><a href="contact.php">Contact Us</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
</div>
<!-- header-wrapper ends here -->
<!-- breadcrumb starts here -->
<div class="breadcrumb-wrapper">
<div class="container">
<h1>Gallery</h1>
<div class="breadcrumb">
<a href="index.php">Home</a>
<span class="default"> </span>
<h4>Gallery</h4>
</div>
</div>
</div>
<!-- breadcrumb ends here -->
<div id="main">
<!-- main-content starts here -->
<div id="main-content">
<section id="primary" class="content-full-width">
<div class="dt-sc-hr-invisible"></div>
<div class="dt-sc-hr-invisible-small"></div>
<div class="container">
<div class="dt-sc-portfolio-container">
<?php
$connection = mysql_connect("localhost", "root", "12345"); // Establishing Connection with Server
$db = mysql_select_db("icareimage");
//MySQL Query to read data
$query = mysql_query("SELECT photo FROM photos WHERE type='gallery'", $connection);
while ($row = mysql_fetch_array($query))
{?>
<div class="portfolio dt-sc-one-third column flexibility games">
<div class="portfolio-thumb">
<?php echo' <img src="images/photos/'.$row["photo"].'"/>'; ?>
<div class="image-overlay">
<div class="fig-content-wrapper">
<div class="fig-overlay">
<p>
<a href="" class="zoom" > <span class="fa fa-plus"> </span></a>
</p>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</section>
</div>
</div>
<!-- support starts here -->
<!-- paralax starts here -->
<div class="fullwidth-section full-man">
<div class="container">
<div class="dt-sc-one-half column first animate" data-animation="fadeInUp" data-delay="100">
<h3 class="section-title">Make an Appointment</h3>
<div id="ajax_contact_msg"></div>
<form name="frmcontact" action="#" method="post" id="contact-form">
<div class="dt-sc-one-half column first">
<input type="text" name="txtname" placeholder="Enter name..." required>
</div>
<div class="dt-sc-one-half column">
<input type="email" name="txtemail" placeholder="Enter email..." required>
</div>
<div class="dt-sc-one-half column first">
<input type="text" name="txtname" placeholder="Enter Phone..." required>
</div>
<div class="dt-sc-one-half column">
<input type="email" name="txtemail" placeholder="Select Date..." required>
</div>
<div class="clear"></div>
<div class="selection-box">
<select name="cmbsubject">
<option value="Ask a Question?">Select Treatment</option>
<option value="">Cosmetic Dentistry</option>
<option value="">Dental Implants</option>
<option value="">Periodontal Care</option>
<option value="">Endodontic Treatment</option>
<option value="">Pediatric Dentistry</option>
<option value="">Orthodontics</option>
<option value="">Restorative Dentistry</option>
</select>
</div>
<div class="clear"></div>
<div class="selection-box">
<select name="cmbsubject">
<option value="Ask a Question?">What time you would like to come in</option>
<option value="">Morning</option>
<option value="">Afternoon</option>
<option value="">Evening</option>
</select>
</div>
<textarea name="txtmessage" placeholder="Type your queries..." required></textarea>
<input type="submit" name="submit" value="Submit Query">
</form>
</div>
<div class="dt-sc-one-half column"> <img src="images/man.png" alt="" title="" class="aligncenter"> </div>
</div>
</div>
<!-- paralax ends here -->
</section>
</div>
<!-- Team starts here -->
</div>
<!-- Team ends here -->
<!-- main-content ends here -->
</div>
<div class="dt-sc-hr-invisible-medium"></div>
<!-- footer starts here -->
<footer id="footer">
<div class="footer-widgets-wrapper">
<div class="container">
<div class="column dt-sc-one-fourth first">
<aside class="widget widget_text">
<div class="textwidget">
<h3 class="widgettitle"><span class="fa fa-user"></span>About Us</h3>
<p>The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, making it look like readable English. </p>
<p>The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters</p>
</div>
</aside>
</div>
<div class="column dt-sc-one-fourth">
<aside class="widget widget_text">
<h3 class="widgettitle"><span class="fa fa-link"></span>Ouick Links</h3>
<div class="textwidget">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About Us</a></li>
<li><a href="packages.php">Services</a></li>
<li><a href="appoinment.php">Appoinment</a></li>
<li><a href="gallery.php">Galery</a></li>
<li><a href="contact.php">Contact Us</a></li>
</ul>
</div>
</aside>
</div>
<div class="column dt-sc-one-fourth">
<aside class="widget widget_text">
<h3 class="widgettitle"><span class="fa fa-link"></span>Our Services</h3>
<div class="textwidget">
<ul>
<li><a href="cosmetic_dentistry.php">Cosmetic Dentistry</a></li>
<li><a href="dental_implant.php">Dental Implants</a></li>
<li><a href="periodontal_care.php">Periodontal Care</a></li>
<li><a href="endodontic_treatment.php">Endodontic Treatment</a></li>
<li><a href="pediatric_dentistry.php">Pediatric Dentistry</a></li>
<li> <a href="orthodontics.php">Orthodontics </span> </span> </a> </li>
<li> <a href="restorative_dentistry.php">Restorative Dentistry </span> </span> </a> </li>
</ul>
</div>
</aside>
</div>
<div class="column dt-sc-one-fourth">
<aside class="widget widget_recent_entries">
<h3 class="widgettitle"><span class="fa fa-calendar"></span>Contact Us</h3>
<!-- <div class="recent-posts-widget">
<ul>
<li> <a href="#" class="entry-thumb"><img src="images/blog-thumb.jpg" alt="" title=""></a>
<h4><a href="#">Training with Dumbell</a></h4>
<div class="entry-metadata">
<p class="date">26 May 2014</p>
</div>
</li>
<li> <a href="#" class="entry-thumb"><img src="images/blog-thumb1.jpg" alt="" title=""></a>
<h4><a href="#">Create the Adonis Effect</a></h4>
<div class="entry-metadata">
<p class="date">24 May 2014</p>
</div>
</li>
</ul>
</div>-->
<div class="textwidget">
<p>Image Dental clinic<br/>
Riyadh - Specialist Street<br/>
Tel : +966 1 4836060<br/>
Fax : +966 1 483770<br/>
</p>
</div>
</aside>
</div>
</div>
<div class="social-media-container">
<div class="social-media">
<div class="container">
<div class="dt-sc-contact-info dt-phone">
<p><i class="fa fa-phone"></i> <span>966 1 4836060</span> </p>
</div>
<ul class="dt-sc-social-icons">
<li class="facebook"><a href="#" class="fa fa-facebook"></a></li>
<li class="google"><a href="#" class="fa fa-google-plus"></a></li>
<li class="twitter"><a href="#" class="fa fa-twitter"></a></li>
<li class="youtube"><a href="#" class="fa fa-youtube"></a></li>
<li class="rss"><a href="#" class="fa fa-rss"></a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="copyright">
<div class="container">
<ul class="footer-links">
<li><a href="about.php"> About Us </a></li>
<li><a href="service.php"> Services </a></li>
<li><a href="contact.php"> Contact Us </a></li>
</ul>
<p>© 2015 - Image Dental Clinic</p>
</div>
</div>
</footer>
</body>
</html>
答案 0 :(得分:1)
//using image name
mysql_connect("localhost","xxxx","xxxxxxx");
mysql_select_db("wellho");
$image = stripslashes($_REQUEST[imname]);
$rs = mysql_query("select * from im_library where filename=\"".
addslashes($image).".jpg\"");
$row = mysql_fetch_assoc($rs);
$imagebytes = $row[imgdata];
header("Content-type: image/jpeg");
print $imagebytes;
//using image Id
include 'inc/db.php';
$id = addslashes($_REQUEST['id']);
$image = mysql_query("SELECT image FROM sites WHERE id = '$id'");
$image = mysql_fetch_assoc($image);
$image = $image['image'];
header("Content-type: image/png");
echo $image;
答案 1 :(得分:1)
$query = mysql_query("SELECT * FROM table_name WHERE id={$id}");
$result = mysql_fetch_array($query);
echo "<img src='images/$result["image_columnname"]' />";