PHP Classes

defining defaults

Recommend this page to a friend!

      csv2mysql database migration tool  >  All threads  >  defining defaults  >  (Un) Subscribe thread alerts  
Subject:defining defaults
Summary:I'm stumped
Messages:3
Author:Julian Toler
Date:2005-05-24 12:23:51
Update:2008-01-11 23:37:56
 

  1. defining defaults   Reply   Report abuse  
Picture of Julian Toler Julian Toler - 2005-05-24 12:23:51
Hi
Just hope someone can help here as thisd class looks like it should be exctly what I need:
When I run it the output tells me the following:

file uploaded successfully • Reading data from csv file: ./dump.csv
• Started to create data array
• validating array elements to generate sql from
• product_name has no default and you have not specified a value for this field.
• description has no default and you have not specified a value for this field.
Field product_name has no default
Field description has no default
Please specify values for the missing fields please add definitions for these fields.

Not sure where I am going wrong

I have defined defaults such as
$i->add_db_instruction("product_name", "product name not set");
and then run
$i->get_instruction_values();

I don't need to do any processing on the data, just whack it into the appropriate fields of my database.

I would be very grateful if anyone has any tips...

  2. Re: defining defaults   Reply   Report abuse  
Picture of Roman Roman - 2006-09-12 12:01:08 - In reply to message 1 from Julian Toler
same problem
need help

  3. Re: defining defaults   Reply   Report abuse  
Picture of G. Miernicki G. Miernicki - 2008-01-11 23:37:56 - In reply to message 1 from Julian Toler
This class is the shit! Thanks to whoever coded it, it saved me countless hours today importing some spreadsheet data into a database! Were going to be using it to do daily imports of accounting data into our company's global data repository server.

BTW, in case you need to convert the spreadsheet to .csv first because its in some weird format that this script can't use, then try xls2csv, a great app thats a part of catdoc (a suite of utils for linux).

A final note should be said that the author didn't include a function to do the actual data import, it just dumps it to the screen, so I had to add my own doImport() function and have it called when this statement is executed:

$i->create_sql(0);