How to upload a slider (carousel) from the database?
How to upload a slider (carousel) from the database?
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.
addimage.php
( <?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"; } } <?php > ?> <!DOCTYPE html>
Add Sliders
</style> <?php while($row= mysqli_fetch_array($result)){ echo "<div id='img_div'>"; echo "
".$row['id']."
"; echo "".$row['nom']."
"; echo ""; echo "".$row['text']."
"; ?> <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>
<?php
echo "</div>";
}
?>)
Thanks for your help
Answers
How does this relate to DataTables?