The purpose of this blogging site to provide coding tutorials, notes,coding tips, MCQs and code examples. You will find tutorials on various IT technologies. This site main goal is helping beginners to become developers. These programming tutorials teach you how to program, and improve coding skills. You will find tutorials on various programming languages. It may help you to shape up your coding ability. Find simple and straight forward coding techniques. Keep visiting..
Uploading Multiple Files in PHP
Get link
Facebook
X
Pinterest
Email
Other Apps
How to Upload multiple files and store in a folder and array
Sometimes we need to upload more than one file at a time. This tutorial helps you how to upload many files and store them in a folder and get their names stored in the PHP array. In this example, there are two files. Create a folder in the server and copy the files given below. Open index.php and check the result.
index.php
upload.php
index.php : Contains front-end code(form for uploading files) and allows user to upload more than one file at a time. User selects multiple files, and clicks on submit button.
upload.php: will receives the files and stores them in a folder and also in an array. Next, using for loop, it prints the names of the uploaded files and the preview of the images.
Recently viewed list in PHP MySQL Learn How to show recently viewed products list in a PHP website using MySQL Database . In the previous tutorial, you learn how to get the last five product IDs in an array. In this tutorial, we use MySQL to get the details of each product from recently viewed, and display them in the bottom of the product details page. Here we're using two files, one is bookdetails.php and another is recentlyviewed.php. In Bookdetails.php bookid is added to a session array 'lastviewed' every time when user clicks on some book. bookdetails.php <?php @ session_start (); include "connect.php" ; //check if //A) a bookid has been submitted //B) the submitted value is numeric $auth = "" ; if ( isset ( $_GET [ 'bid' ])){ //clean it up if (! is_numeric ( $_GET [ 'bid' ])){ //Non numeric value entered. Someone tampered with the catid $error = true ; $errormsg = " Security, Serious error. Contact webmast...
Learn How to Import CSV File into MySQL Database Using PHP This article shows you how to import an uploaded CSV file into MySQL using PHP. index.php file having a form code to upload a CSV file. Once the file uploaded successfully, PHP opens it and reads the line from CSV. Each line of data separated into php variables and then inserted into MySQL table. This process continues until the last line of the CSV. Once it is finished inserting, It displays a message – " Data Inserted in database" And finally closes CSV file. In case any error in uploading, it shows "the file type not allowed" message. PHP Version 5.5.11 1. Create a table with given code in a Database. Query: CREATE TABLE IF NOT EXISTS `items` ( `id` int ( 11 ) NOT NULL AUTO_INCREMENT , `title` varchar ( 100 ) DEFAULT NULL , `description` varchar ( 100 ) DEFAULT NULL , PRIMARY KEY ( `id` ) ) ; 2. Create a following file with you database details and include it in a index.ph...
How to show a list of recently viewed products in PHP Mostly when you are visiting ecommerce websites, you will see a short browsing history of recently view products. This list allows the user to visit back again more easily to a product page they have just seen or add it to a wishlist or as a reminder. So that they don’t forget about something which may have interested them. In this tutorial, you will learn how to display the last 5 products viewed , by storing the product ID from the product details page in an array within the session. Steps: Here are some steps that we need to follow to achieve… • Add the clicked product's ID to an array when the product detail page is visited by a user. • Store up to 5 product IDs in the array. • Skip the same product being added to the array twice. • Show the collected product IDs in an array. Step 1: Adding the product ID to an array. At the top of the product detail page, create a session, and set the value. Here, we used 'recentlyviewe...
Comments
Post a Comment