Sunday, June 28, 2009

Re: LOAD DATA INFILE selective column

I want to import data from Local file(CSV) to Mysql 5.0 table with only selected column.

My PHP code is... as per Mysql5.0 syntax
$query="LOAD DATA LOCAL INFILE '". @mysql_escape_string($tmpupfile) . "' INTO TABLE item_master (item_code,item_desc) FIELDS TERMINATED BY '" . "," ."'";

It gives syntax error.

Following works fine... put column(field) list at the end.

$query="LOAD DATA LOCAL INFILE '". @mysql_escape_string($tmpupfile) . "' INTO TABLE item_master FIELDS TERMINATED BY '" . "," ."' (item_code,item_desc)";

Thursday, June 18, 2009

Writing Blog in Hindi

आप हिंदी, गुजराती, मराठी और अन्य भारतीय भाषा में आसानी से लिख सकते हे|
इसके लिए आप http://www.google.com/transliterate/indic/Hindi की मुलाकात ले |
वहा से कॉपी कर के अपने ब्लॉग में पेस्ट करे और कोई भी UTF-8 एडिटर में एडिट केरे !
धन्यवाद सह,
कार्तिकेय

Saturday, June 13, 2009

Fatal error: Cannot redeclare _pear_call_destructors()

I was using PEAR HTML_Quick_forms and using my ISP PEAR.php and Quickform.php I got following message..

Fatal error: Cannot redeclare _pear_call_destructors() (previously declared in /home/myusername/myuserincludes/PEAR/PEAR.php:765) in /usr/lib/php/PEAR.php on line 796

Solution:
I made following change in Quickform.php...
line
require_once 'PEAR.php';
replace with line
require_once 'PEAR5.php';

just force to use PEAR5

You may also change PEAR.php by adding if (!function_exists("_pear_call_destructors()")){
before line
function _pear_call_destructors(){
also add } after end of Function.