I want to retrieve the images from mysql list in my php from

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fruity
    New Member
    • Jul 2015
    • 1

    I want to retrieve the images from mysql list in my php from

    Here my code i retrieved the images like url from mysql but i want that image to show in mylist not url to show my list.


    Code:
    <?php
    		$st=mysqli_connect("localhost","root","","charity");
    		//$id=$_REQUEST['id'];
    		//$sql='select  * from adminlogin'; 
    		//$res=$st->query($sql);
    		//$sql='select distinct dept from stu1';
    		$result = mysqli_query($st,"SELECT * FROM redspotcharity");
    		?>
    		<form action="redchartiyadmin.php">
    				<input type="submit" class="btn btn-info" value="Add a New Record">
    		</form>
    		<!--<section class="wrapper scrollable" style="overflow-x: scroll;">-->
    <div class="control-group pull-left" style="width:80%;height:100%;text-align:center;padding-left:2%"> 
    			
    			<table id="example" class="display" cellspacing="0" width="100%">
    				<thead>
    					<tr class="success">
    					<th>CHARITY TYPE</th>
    					<th>CHARITY NAME</th>
    					<th>ADDRESS OF CharityMember</th>
    					<th>PHONE NUMBER</th>
    					<th>IMAGE</th>
    					<th>View/Edit/Delete</th>
    					</tr>
    				</thead>
    				<tbody>
    				<?php
    				while($row = mysqli_fetch_array($result))
    				{
    						echo"<tr>";
    						echo "<td>" .$row['charity_type']."</td>";
    						echo "<td>" .$row['chairty_name']."</td>";
    				echo "<td>".$row['address1']."<br/>" .$row['address2']."<br/>".$row['city']. "<br/>" .$row['state']. "<br/>".$row['country']."<br/>".$row['zip_code']."</td>";
    						echo "<td>"	.$row['phone_number']."</td>";
    						echo "<td>"	.$row['logo1']."</td>";
    						echo '<td><a href="redcepteditnew.php?id='.$row['charitytype_id'].'"><span class="glyphicon glyphicon-list-alt"></span></a><a href="redcepteditnew.php?id='.$row['charitytype_id'].'"><span class="glyphicon glyphicon-pencil"></span></a> 
    						<a href="redceptdelete.php?id='.$row['charitytype_id'].'"><span class="glyphicon glyphicon-trash"></span></a></td>';
    					echo"</tr>";
    				}
    				header("Content-type: image/jpeg");
    					?>
    				</tbody>
    			</table>
    			</div>	
    <!--</section>-->
    			<?php mysqli_close($st);?>
    	<!--- end -->
    	</div><!--/#
    Last edited by Rabbit; Jul 2 '15, 04:29 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • computerfox
    Contributor
    • Mar 2010
    • 276

    #2
    If you want to show the actual image, you would use an image tag with the path.
    Is this what you're asking for?

    Comment

    • Exequiel
      Contributor
      • Jul 2012
      • 288

      #3
      on your line 35 try this code. :) this how to use img tag, you must also put the path of your image and its extension name.
      Code:
      <?php 
      echo '<img src="pathofyourimage/'.$row['logo1'].'">';
      ?>

      Comment

      • computerfox
        Contributor
        • Mar 2010
        • 276

        #4
        Thanks for reiterating what I said :-)

        Comment

        Working...