php - Image not showing on image slider -


hello im creating dynamic image slider image not showing. can upload image in file directory. don't know problem if database problem or what. i'm new html , css php. can give me ideas caused of not showing images?

here image not showing can upload file gallery file directory. enter image description here

here database sql. enter image description here

here php code.

<?php //for connecting db include('connect.php'); if (!isset($_files['image']['tmp_name'])) { echo ""; } else { $file=$_files['image']['tmp_name']; $image= addslashes(file_get_contents($_files['image']['tmp_name'])); $image_name= addslashes($_files['image']['name']); move_uploaded_file($_files["image"]["tmp_name"],"gallery/" . $_files["image"]["name"]); $photo="gallery/" . $_files["image"]["name"];   $query = mysqli_query($mysqli, "insert images(photo)values('$photo')"); $result = $query;   echo '<script type="text/javascript">alert("image uploaded ");window.location=\'index.php\';</script>'; } ?> <!doctype html> <html>     <head>         <link href="css/style.css" rel="stylesheet" />         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>         <script src="js/slider.js"></script>         <script>         $(document).ready(function () {         $('.flexslider').flexslider({         animation: 'fade',         controlscontainer: '.flexslider'         });         });         </script>     </head>     <body>     <div class="container">     <form class="form" action="" method="post" enctype="multipart/form-data">         <div class="image">             <p>upload images , try self </p>         <div class="col-sm-4">               <input class="form-control" id="image" name="image" type="file" onchange='alertfilesize();'/>               <input type="submit" value="image"/>             </div>         </div>         </form>         <div class="flexslider">             <ul class="slides">                 <?php                     // creating query fetch images database.                    $query = mysqli_query($mysqli, "select * images order id desc limit 5");                     $result = $query;                     while($r = mysqli_fetch_array($result)){                  ?>                     <li>                     <img src="<?php echo $r['photo'];?>" width="400px" height="300px"/>                     </li>                 <?php                  }                  ?>             </ul>         </div>     </div>     </body> </html> 

here connect.php

<?php // hostname or ip of server $servername='localhost'; // username , password log onto db server $dbusername='root'; $dbpassword=''; // name of database $dbname='pegasus';  ////////////// not  edit below///////// $mysqli = new mysqli($servername,$dbusername,$dbpassword,$dbname); if($mysqli->connect_errno){     printf("connect failed: %s\n", $mysql->connect_error);     exit(); }  ?> 

image shows column name image , fetching records column name photo.

just change

<img src="<?php echo $r['photo'];?>" width="400px" height="300px"/> 

to

<img src="<?php echo $r['image'];?>" width="400px" height="300px"/> 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -