Note that there are some explanatory texts on larger screens.

plurals
  1. POCSV to MySQL via PHP
    primarykey
    data
    text
    <p>Trying to upload CSV file html/php form to mysql database...</p> <p><strong>UPDATE NOW WITH NO ERROR</strong></p> <pre><code> if ( isset( $_FILES['userfile'] ) ){ $csv_file = $_FILES['userfile']['tmp_name']; if ( ! is_file( $csv_file ) ){ exit('File not found.'); } $sql = "LOAD DATA INFILE '" . $csv_file . "' INTO TABLE testing_db FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\r\n'"; $result = $dbh-&gt;query($sql); } </code></pre> <p><strong>Nothing gets added into my database...</strong></p> <p><strong>UPDATE 2</strong></p> <pre><code> if(isset($_FILES['file'])){ $csv_file = $_FILES['file']['name']; $upload = 'csv-uploads/' . $csv_file; move_uploaded_file($_FILES["file"]["tmp_name"], $upload); $sql = "LOAD DATA INFILE '".$upload."' INTO TABLE testing_db FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES"; $result = $dbh-&gt;query($sql); ini_set('display_errors', 1); error_reporting(E_ALL); } ?&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Head Exploding Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form enctype="multipart/form-data" method="POST"&gt; &lt;input name="file" type="file"&gt; &lt;input type="submit" value="Upload"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>reading a few more posts, so i placed the file into an upload folder and tried to use that filepath, the file uploads to the folder but does not upload to my database. Read all the documentation, but have no idea.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload