<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Tips and Tricks</title>
	<atom:link href="http://www.legend.ws/blog/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.legend.ws/blog</link>
	<description>Find useful tips and tricks related to your every day techy needs</description>
	<lastBuildDate>Fri,  5 Mar 2010 17:03:46 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on PHP script to import csv data into mysql by data_type</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-18860</link>
		<dc:creator>data_type</dc:creator>
		<pubDate>Fri, 05 Mar 2010 17:03:46 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-18860</guid>
		<description>[...] that there were some very good properties that I could use to help me teach people PL/SQL and XML. ITips and Tricks PHP script to import csv data into mysqlPHP script to import csv data into mysql ... [...]</description>
		<content:encoded><![CDATA[<p>[...] that there were some very good properties that I could use to help me teach people PL/SQL and XML. ITips and Tricks PHP script to import csv data into mysqlPHP script to import csv data into mysql &#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by Kish</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-18612</link>
		<dc:creator>Kish</dc:creator>
		<pubDate>Wed, 17 Feb 2010 19:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-18612</guid>
		<description>This is very Useful code for me..
thanks.

How can i get the browse file instead of typing the full path name..

Please help in this.

thanks</description>
		<content:encoded><![CDATA[<p>This is very Useful code for me..<br />
thanks.</p>
<p>How can i get the browse file instead of typing the full path name..</p>
<p>Please help in this.</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by rajdeo</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-18383</link>
		<dc:creator>rajdeo</dc:creator>
		<pubDate>Thu, 04 Feb 2010 12:21:49 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-18383</guid>
		<description>i did not get it how it work from a file control. means first browse and choose a file and then submit where i need to modified</description>
		<content:encoded><![CDATA[<p>i did not get it how it work from a file control. means first browse and choose a file and then submit where i need to modified</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by Mark Camp</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-18109</link>
		<dc:creator>Mark Camp</dc:creator>
		<pubDate>Mon, 11 Jan 2010 05:10:09 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-18109</guid>
		<description>Hello,

Made some modifications. My .txt file has 3 columns separated by a &quot;&#124;&quot; (pipe) character. The script displays the file data, counts the rows, but does not enter the data into the database. Any comments?

$csvcontent = fread($file,$size);

fclose($file);

$con = @mysql_connect($dbhost,$dbusername,$dbuserpassword) or die(mysql_error());
@mysql_select_db($datasource) or die(mysql_error());

$lineseparator = &quot;\n&quot;;
$fieldseparator = &quot;&#124;&quot;;

$lines = 0;
$queries = &quot;&quot;;
$linearray = array();

$count = 0;



foreach(split($lineseparator,$csvcontent) as $line) {

	$count = $count + 1;

	$lines++;

	$line = trim($line,&quot; \t&quot;);
	
	$line = str_replace(&quot;\r&quot;,&quot;&quot;,$line);
	
	/************************************
	This line escapes the special character. remove it if entries are already escaped in the csv file
	************************************/
	$line = str_replace(&quot;&#039;&quot;,&quot;\&#039;&quot;,$line);
	/*************************************/
	
	$linearray = explode($fieldseparator,$line);
	
	$linemysql = implode(&quot;&#039;&#039;&quot;,$linearray);
	
	if($addauto)
	
		$query = &quot;insert into INDICATORS values(&#039;$count&#039;,&#039;$linemysql&#039;);&quot;;

	else

		$query = &quot;insert into INDICATORS values(&#039;$linemysql&#039;);&quot;;
	
	$queries .= $query . &quot;\n&quot;;

	@mysql_query($query) or die(mysql_error());
	
	echo &quot;$linemysql\n&quot;;
}</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>Made some modifications. My .txt file has 3 columns separated by a &#8220;|&#8221; (pipe) character. The script displays the file data, counts the rows, but does not enter the data into the database. Any comments?</p>
<p>$csvcontent = fread($file,$size);</p>
<p>fclose($file);</p>
<p>$con = @mysql_connect($dbhost,$dbusername,$dbuserpassword) or die(mysql_error());<br />
@mysql_select_db($datasource) or die(mysql_error());</p>
<p>$lineseparator = &#8220;\n&#8221;;<br />
$fieldseparator = &#8220;|&#8221;;</p>
<p>$lines = 0;<br />
$queries = &#8220;&#8221;;<br />
$linearray = array();</p>
<p>$count = 0;</p>
<p>foreach(split($lineseparator,$csvcontent) as $line) {</p>
<p>	$count = $count + 1;</p>
<p>	$lines++;</p>
<p>	$line = trim($line,&#8221; \t&#8221;);</p>
<p>	$line = str_replace(&#8220;\r&#8221;,&#8221;",$line);</p>
<p>	/************************************<br />
	This line escapes the special character. remove it if entries are already escaped in the csv file<br />
	************************************/<br />
	$line = str_replace(&#8220;&#8216;&#8221;,&#8221;\&#8217;&#8221;,$line);<br />
	/*************************************/</p>
<p>	$linearray = explode($fieldseparator,$line);</p>
<p>	$linemysql = implode(&#8220;&#8221;&#8221;,$linearray);</p>
<p>	if($addauto)</p>
<p>		$query = &#8220;insert into INDICATORS values(&#8216;$count&#8217;,'$linemysql&#8217;);&#8221;;</p>
<p>	else</p>
<p>		$query = &#8220;insert into INDICATORS values(&#8216;$linemysql&#8217;);&#8221;;</p>
<p>	$queries .= $query . &#8220;\n&#8221;;</p>
<p>	@mysql_query($query) or die(mysql_error());</p>
<p>	echo &#8220;$linemysql\n&#8221;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by Mark Cloyd</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-17990</link>
		<dc:creator>Mark Cloyd</dc:creator>
		<pubDate>Mon, 04 Jan 2010 00:33:39 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-17990</guid>
		<description>Excellent script!  I needed a little jump start for a project I was working on and this did the trick.  

I did notice something odd however, I modified the script to work with a form and I did notice that for searching, the last field was getting buggered up because the new line char (either \r or \n or both) was still being recorded in the MySQL database.

To that end, if you replace:
$line = str_replace(&quot;\r&quot;,&quot;&quot;,$line);

with:
$line = str_replace(&#039;\r&#039;,&#039;&#039;,$line);

it will keep the return from being a problem, as for the new line, I have added a little something that allows for inserting new records, but updates existing records, so that you don&#039;t end up with duplicate entries.  At the top of the code below, you will see where I made the same fix for the actual new line char.

$linemysql = implode(&quot;&#039;,&#039;&quot;,$linearray);

	

$newlinemysql = str_replace(&#039;\n&#039;,&#039;&#039;,$linemysql);

	

if($addauto) {

	switch($databasetable) {

		case(&#039;address&#039;):

		        $duplicatevals = &quot;address = VALUES(address),
                        city = VALUES(city),state = VALUES(state),

			zip = VALUES(zip)&quot;;

		break;

			

		case(&#039;owner&#039;):

			$duplicatevals = &quot;ownername = VALUES(ownername),
                        housetype = VALUES(housetype),

			addresskey = VALUES(addresskey)&quot;;

		break;				

	}

		

		$query = &quot;insert into $databasetable values(&#039;&#039;,&#039;$newlinemysql&#039;)

		ON DUPLICATE KEY UPDATE

		$duplicatevals&quot;;

	} else {

		$query = &quot;insert into $databasetable values(&#039;$linemysql&#039;)

		ON DUPLICATE KEY UPDATE

		$duplicatevals&quot;;		

	}

Also, in my form I added the table name and whether I wanted the table to be [boolean] &quot;addauto&quot; or not as a single input from a drop-down (comma separated), then split the result at the top of the simplecsvimport script.

Finally, you have to remember to set indexes in the database for the, &quot;ON DUPLICATE...&quot; to work, auto increments will not work in this case, so you have to set a secondary index on the auto increment tables, the tables that don&#039;t auto increment and have unique fields work with the single index if that is the route you would like to go.

I hope this helps someone!

Cheers!</description>
		<content:encoded><![CDATA[<p>Excellent script!  I needed a little jump start for a project I was working on and this did the trick.  </p>
<p>I did notice something odd however, I modified the script to work with a form and I did notice that for searching, the last field was getting buggered up because the new line char (either \r or \n or both) was still being recorded in the MySQL database.</p>
<p>To that end, if you replace:<br />
$line = str_replace(&#8220;\r&#8221;,&#8221;",$line);</p>
<p>with:<br />
$line = str_replace(&#8216;\r&#8217;,&#8221;,$line);</p>
<p>it will keep the return from being a problem, as for the new line, I have added a little something that allows for inserting new records, but updates existing records, so that you don&#8217;t end up with duplicate entries.  At the top of the code below, you will see where I made the same fix for the actual new line char.</p>
<p>$linemysql = implode(&#8220;&#8216;,&#8217;&#8221;,$linearray);</p>
<p>$newlinemysql = str_replace(&#8216;\n&#8217;,&#8221;,$linemysql);</p>
<p>if($addauto) {</p>
<p>	switch($databasetable) {</p>
<p>		case(&#8216;address&#8217;):</p>
<p>		        $duplicatevals = &#8220;address = VALUES(address),<br />
                        city = VALUES(city),state = VALUES(state),</p>
<p>			zip = VALUES(zip)&#8221;;</p>
<p>		break;</p>
<p>		case(&#8216;owner&#8217;):</p>
<p>			$duplicatevals = &#8220;ownername = VALUES(ownername),<br />
                        housetype = VALUES(housetype),</p>
<p>			addresskey = VALUES(addresskey)&#8221;;</p>
<p>		break;				</p>
<p>	}</p>
<p>		$query = &#8220;insert into $databasetable values(&#8221;,&#8217;$newlinemysql&#8217;)</p>
<p>		ON DUPLICATE KEY UPDATE</p>
<p>		$duplicatevals&#8221;;</p>
<p>	} else {</p>
<p>		$query = &#8220;insert into $databasetable values(&#8216;$linemysql&#8217;)</p>
<p>		ON DUPLICATE KEY UPDATE</p>
<p>		$duplicatevals&#8221;;		</p>
<p>	}</p>
<p>Also, in my form I added the table name and whether I wanted the table to be [boolean] &#8220;addauto&#8221; or not as a single input from a drop-down (comma separated), then split the result at the top of the simplecsvimport script.</p>
<p>Finally, you have to remember to set indexes in the database for the, &#8220;ON DUPLICATE&#8230;&#8221; to work, auto increments will not work in this case, so you have to set a secondary index on the auto increment tables, the tables that don&#8217;t auto increment and have unique fields work with the single index if that is the route you would like to go.</p>
<p>I hope this helps someone!</p>
<p>Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by phpwebdesigner2010</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-17453</link>
		<dc:creator>phpwebdesigner2010</dc:creator>
		<pubDate>Wed, 09 Dec 2009 02:39:34 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-17453</guid>
		<description>I need to download data automatically from a remote server.  Its a CSV file, and i need to unzip it, and store the data in a mysql database that i created.  There are multiple databases.  The first section below is one of the databases that someone helped me with and it works wonderfully.  I set up a cron job and it downloads it automatically as scheduled.  However i have more databases and cant get the others to work.


THIS SECTION BELOW WORKS FINE!!!!
-----------------------------------------------------------------------------

#!/bin/bash

deleteparam=&#039;--delete-after&#039;;
#deleteparam=&#039;&#039;
#directory=&#039;--directory-prefix=/$HOME/myfolder/myfolder/&#039;
directory=&#039;&#039;
#userpwd=&#039;--http-user=blah --http-password=blah&#039;

toUpper() {
echo $1 &#124; tr  &quot;[:lower:]&quot; &quot;[:upper:]&quot;
}

#if [ -z &quot;$1&quot; ]; then 
#   echo usage: $0 table
#exit
#fi

ZIP=name of data file in remote server
ZIP=`toUpper $ZIP`

#the file within the zip has one less _
DATA=name of table in my mysql database
DATA=`toUpper $DATA`

#rm $TABLE.csv.zip
#rm $DATA.csv

cd /$HOME/myfolder/myfolder/
#######get the residential

wget &#039;http://3pv.mlslirealtor.com/Data3pv/DownloadBRSaction.asp?user_code=XXXXXX&amp;password=XXXXXXX&amp;data_type=datazip&#039; -O $ZIP.csv.zip
sleep 10
#######unzip it
pwd
ls -la

unzip -o $ZIP.csv.zip
sleep 10
#######load it 

wget --verbose $deleteparam $directory $userpwd http://mywebsite/myfolder/import.php?table=$DATA
sleep 300

######delete the files

rm $ZIP.csv.zip
rm $DATA.csv
sleep 10
_---------------------------------------------------------------------------------
ALL OF THIS ABOVE WORKS WONDERFUL


THIS IS WHAT I NEED HELP WITH
----------------------------------------------------------------------------
1.  I need a script to add to the above file that will download the photos.  If you see below i need a script that automatically gets the CURRENT date and time that the script is ran.  There server holds pic from the last 7 days and is constantly updated.  Once this script is ran it will download the data into the table that i created.

2.  Then, I need a script that queries the mysql database looking for entries that have photos and then retrieve the actual photos directly from their remote servers.  This csv file DOES NOT download photos, just data that i can use to run a script to retrieve the photos at a given spot.  See below.
Below are the instructions I received.

INSTRUCTIONS
 Photo data is retrieved by HTTP. The photos data is updated once daily and is available for download as a CSV file.  You can then write a script using the data from the CSV file to point back to the images on our image server.  YOU MUST SUPPLY A VALUE FOR THE QUERY STRING last_updt &gt; &#039;YYYYMMDD HH:MM:SS&#039; for the URL to return data.   The field last_updt is the date value for the last time that a photo was changed on the listing.    

You will need to replace the user_code and password place holders (XXXX) with the login credentials provided to you.

Step 1:  To retrieve the primary listing photo data CSV file go to the URL below.

http://remotewebserver/Data3pv/DownloadBRSaction.asp?user_code=XXX&amp;password=XXXX&amp;query_str=last_updt%20&gt;%20&#039;YYYYMMDD%20HH:MM:SS&#039;&amp;data_type=PHOTOS
 
Step 2:  The photos table data should download in a CSV format.

Step 3:  Using the Y flags and the ML Number in the data you can link back to our image locations.

Our primary image directory path is as follows:

http://remoteserver/folder/folder/folder/Last3DigistsofML#/listing#.jpg

For example- The primary photo for listing number 1899430 is located at

http://remoteserver/folder/folder/1/430/1899430.jpg

Our additional image directory path structure is as follows:

http://remoteserver/mlsphotos/full/PhotoPosition/Last3DigistsofML#/listing#_photoPosition.jpg


For example- The second photo for listing number 1899430 is located at

http://remoteserver/folder/folder/2/430/1899430_2.jpg</description>
		<content:encoded><![CDATA[<p>I need to download data automatically from a remote server.  Its a CSV file, and i need to unzip it, and store the data in a mysql database that i created.  There are multiple databases.  The first section below is one of the databases that someone helped me with and it works wonderfully.  I set up a cron job and it downloads it automatically as scheduled.  However i have more databases and cant get the others to work.</p>
<p>THIS SECTION BELOW WORKS FINE!!!!<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>#!/bin/bash</p>
<p>deleteparam=&#8217;&#8211;delete-after&#8217;;<br />
#deleteparam=&#8221;<br />
#directory=&#8217;&#8211;directory-prefix=/$HOME/myfolder/myfolder/&#8217;<br />
directory=&#8221;<br />
#userpwd=&#8217;&#8211;http-user=blah &#8211;http-password=blah&#8217;</p>
<p>toUpper() {<br />
echo $1 | tr  &#8220;[:lower:]&#8221; &#8220;[:upper:]&#8221;<br />
}</p>
<p>#if [ -z "$1" ]; then<br />
#   echo usage: $0 table<br />
#exit<br />
#fi</p>
<p>ZIP=name of data file in remote server<br />
ZIP=`toUpper $ZIP`</p>
<p>#the file within the zip has one less _<br />
DATA=name of table in my mysql database<br />
DATA=`toUpper $DATA`</p>
<p>#rm $TABLE.csv.zip<br />
#rm $DATA.csv</p>
<p>cd /$HOME/myfolder/myfolder/<br />
#######get the residential</p>
<p>wget &#8216;http://3pv.mlslirealtor.com/Data3pv/DownloadBRSaction.asp?user_code=XXXXXX&amp;password=XXXXXXX&amp;data_type=datazip&#8217; -O $ZIP.csv.zip<br />
sleep 10<br />
#######unzip it<br />
pwd<br />
ls -la</p>
<p>unzip -o $ZIP.csv.zip<br />
sleep 10<br />
#######load it </p>
<p>wget &#8211;verbose $deleteparam $directory $userpwd <a href="http://mywebsite/myfolder/import.php?table=$DATA" rel="nofollow">http://mywebsite/myfolder/import.php?table=$DATA</a><br />
sleep 300</p>
<p>######delete the files</p>
<p>rm $ZIP.csv.zip<br />
rm $DATA.csv<br />
sleep 10<br />
_&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
ALL OF THIS ABOVE WORKS WONDERFUL</p>
<p>THIS IS WHAT I NEED HELP WITH<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1.  I need a script to add to the above file that will download the photos.  If you see below i need a script that automatically gets the CURRENT date and time that the script is ran.  There server holds pic from the last 7 days and is constantly updated.  Once this script is ran it will download the data into the table that i created.</p>
<p>2.  Then, I need a script that queries the mysql database looking for entries that have photos and then retrieve the actual photos directly from their remote servers.  This csv file DOES NOT download photos, just data that i can use to run a script to retrieve the photos at a given spot.  See below.<br />
Below are the instructions I received.</p>
<p>INSTRUCTIONS<br />
 Photo data is retrieved by HTTP. The photos data is updated once daily and is available for download as a CSV file.  You can then write a script using the data from the CSV file to point back to the images on our image server.  YOU MUST SUPPLY A VALUE FOR THE QUERY STRING last_updt &gt; &#8216;YYYYMMDD HH:MM:SS&#8217; for the URL to return data.   The field last_updt is the date value for the last time that a photo was changed on the listing.    </p>
<p>You will need to replace the user_code and password place holders (XXXX) with the login credentials provided to you.</p>
<p>Step 1:  To retrieve the primary listing photo data CSV file go to the URL below.</p>
<p><a href="http://remotewebserver/Data3pv/DownloadBRSaction.asp?user_code=XXX&amp;password=XXXX&amp;query_str=last_updt%20&#038;gt;%20" rel="nofollow">http://remotewebserver/Data3pv/DownloadBRSaction.asp?user_code=XXX&amp;password=XXXX&amp;query_str=last_updt%20&#038;gt;%20</a>&#8216;YYYYMMDD%20HH:MM:SS&#8217;&amp;data_type=PHOTOS</p>
<p>Step 2:  The photos table data should download in a CSV format.</p>
<p>Step 3:  Using the Y flags and the ML Number in the data you can link back to our image locations.</p>
<p>Our primary image directory path is as follows:</p>
<p><a href="http://remoteserver/folder/folder/folder/Last3DigistsofML#/listing#.jpg" rel="nofollow">http://remoteserver/folder/folder/folder/Last3DigistsofML#/listing#.jpg</a></p>
<p>For example- The primary photo for listing number 1899430 is located at</p>
<p><a href="http://remoteserver/folder/folder/1/430/1899430.jpg" rel="nofollow">http://remoteserver/folder/folder/1/430/1899430.jpg</a></p>
<p>Our additional image directory path structure is as follows:</p>
<p><a href="http://remoteserver/mlsphotos/full/PhotoPosition/Last3DigistsofML#/listing#_photoPosition.jpg" rel="nofollow">http://remoteserver/mlsphotos/full/PhotoPosition/Last3DigistsofML#/listing#_photoPosition.jpg</a></p>
<p>For example- The second photo for listing number 1899430 is located at</p>
<p><a href="http://remoteserver/folder/folder/2/430/1899430_2.jpg" rel="nofollow">http://remoteserver/folder/folder/2/430/1899430_2.jpg</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by Nathan</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-16591</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Tue, 20 Oct 2009 10:59:45 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-16591</guid>
		<description>Hi, it tells me the record count but not putting data into database

Hope you can help

Nathan</description>
		<content:encoded><![CDATA[<p>Hi, it tells me the record count but not putting data into database</p>
<p>Hope you can help</p>
<p>Nathan</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by admin</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-16356</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 08 Oct 2009 21:48:16 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-16356</guid>
		<description>the command is: truncate tablename.

you can insert the following on line 58:
@mysql_query(&quot;truncate $databasetable&quot;);

but this is non reversible! so be careful</description>
		<content:encoded><![CDATA[<p>the command is: truncate tablename.</p>
<p>you can insert the following on line 58:<br />
@mysql_query(&#8220;truncate $databasetable&#8221;);</p>
<p>but this is non reversible! so be careful</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by maff</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-16316</link>
		<dc:creator>maff</dc:creator>
		<pubDate>Wed, 07 Oct 2009 12:24:34 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-16316</guid>
		<description>how can i empty my already filled table before inserting the new file?
or can i update an already existing input?

TRUNCATE, UPDATE? how do i get this in the query?</description>
		<content:encoded><![CDATA[<p>how can i empty my already filled table before inserting the new file?<br />
or can i update an already existing input?</p>
<p>TRUNCATE, UPDATE? how do i get this in the query?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP script to import csv data into mysql by admin</title>
		<link>http://www.legend.ws/blog/tips-tricks/csv-php-mysql-import/comment-page-1/#comment-16280</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 05 Oct 2009 13:46:53 +0000</pubDate>
		<guid isPermaLink="false">http://legend.ws/blog/tips-tricks/csv-php-mysql-import/#comment-16280</guid>
		<description>&lt;a href=&quot;#comment-16266&quot; rel=&quot;nofollow&quot;&gt;@Andy Brotherton&lt;/a&gt;: This means that the query is attempting to insert a record with a number of columns that do not match that of the database table.

1) Are you sure that the CSV file has the exact same number of columns as the table in the database?
2) Is the field separator in this CSV file really a comma? or is it a tab for instance or other? If it&#039;s not a comma, change the value of $fieldseparator on line 12
3) The table need to be already created in the database before attempting to load data into it. Are you sure you have it?</description>
		<content:encoded><![CDATA[<p><a href="#comment-16266" rel="nofollow">@Andy Brotherton</a>: This means that the query is attempting to insert a record with a number of columns that do not match that of the database table.</p>
<p>1) Are you sure that the CSV file has the exact same number of columns as the table in the database?<br />
2) Is the field separator in this CSV file really a comma? or is it a tab for instance or other? If it&#8217;s not a comma, change the value of $fieldseparator on line 12<br />
3) The table need to be already created in the database before attempting to load data into it. Are you sure you have it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
