Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to retrieve image from database in php mysqli

// database connection
  $conn = mysqli_connect("localhost", "root", "", "student");
// Fetch image from database
	$img = mysqli_query($conn, "SELECT * FROM student_table");
     while ($row = mysqli_fetch_array($img)) {     
		
      	echo "<img src='images/".$row['imagename']."' >";   
      
    } 
Comment

display image from mysqli database

<?php // Include the database configuration file  require_once 'dbConfig.php';  // Get image data from database $result = $db->query("SELECT image FROM images ORDER BY uploaded DESC"); ?>

<?php if($result->num_rows > 0){ ?>     <div class="gallery">         <?php while($row = $result->fetch_assoc()){ ?>             <img src="data:image/jpg;charset=utf8;base64,<?php echo base64_encode($row['image']); ?>" />         <?php } ?>     </div> <?php }else{ ?>     <p class="status error">Image(s) not found...</p> <?php } ?>
Comment

PREVIOUS NEXT
Code Example
Php :: update role spatie 
Php :: php curl Content-Length 
Php :: php add to existing associative array 
Php :: laravel query builder select first 
Php :: laravel assets path 
Php :: how make custom menu in wordpress 
Php :: aes php 
Php :: php www to non www redirect 
Php :: php file extension 
Php :: laravel set session timeout 
Php :: arrow function in php 
Php :: push collection php 
Php :: Merge Two Collection or Array 
Php :: php to lowercase 
Php :: php date set utc 
Php :: generate slug on create laravel 
Php :: générer des nombres aléatoires décimaux en php 
Php :: implode array keys in php 
Php :: wherejsoncontains laravel 
Php :: how to pass bearer token in swagger in laravel 
Php :: apiresource laravel 
Php :: get day from date php 
Php :: use resource in laravel 8 
Php :: jwt auth laravel auth without password field 
Php :: install logger bundle in symfony project 
Php :: http_response_code 
Php :: searchable dropdown laravel blade 
Php :: php geolocation package 
Php :: laravel cannot add foreign key constraint 
Php :: in_array php 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =