How to upload a slider (carousel) from the database?

How to upload a slider (carousel) from the database?

meriammeriam Posts: 2Questions: 1Answers: 0

I used the following code to upload the images,
I would like to turn these images into sliders, and have an automatic code.
without having to change the name of the image each time.


( <?php $msg = ""; require'connect.php'; // quand tu tape sur le button upload if(isset($_POST['upload'])){ $target = "photos2/".basename($_FILES['image']['name']); $image = $_FILES['image']['name']; $nom = $_POST['nom']; $text = $_POST['text']; $sql = "INSERT INTO slider (image,nom,text) VALUES ('$image', '$nom', '$text')"; mysqli_query($db,$sql); if(move_uploaded_file($_FILES['image']['tmp_name'],$target)){ $msg = "image uploaded successfully"; }else{ $msg = "error_uploaded"; } } ?>

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--meta pour un site responsive dans tous les appareilles-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags must come first in the head; any other head content must come after these tags -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="shortcut icon" href="image/icone.png">
<!-- Bootstrap -->
<link rel="stylesheet"href="bootstrap/css/bootstrap.min.css">

<!-- my style css -->
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">


Add Sliders


<?php ) ****************************************************************************************************************************** image.php to display the images ( require 'connect.php'; $sql = "SELECT * FROM slider"; $result = mysqli_query($db,$sql); ?>

<?php while($row= mysqli_fetch_array($result)){ echo "<div id='img_div'>"; echo "


"; echo "


"; echo "image"; echo "


"; ?>
   <a href="deleteSlider.php?q=<?=$row['id'] ?>"><i class="fa fa-trash-o text-danger" aria-hidden="true"></i></a>

   <a href="editSlider.php?q=<?=$d['id'] ?>"><i class="fa fa-pencil-square-o text-info" aria-hidden="true"></i></a>

      echo "</div>";

Thanks for your help


Sign In or Register to comment.