Try this:
Hi Ashford.
Thanks Man.
That might work..
I do create the table dynamically with varying columns and the first column is always a PK with a value..
i hope to dynamically populate it with some sample data.
I'll paste what works.
Any more help is appreciated..
regardsOn Thu, Sep 24, 2009 at 5:27 PM, Ashford Kuria <kuriashford@gmail.com> wrote:
Unless your table "$table" is dynamic, you will encounter errors with all insets where column count is not valid
assume $table is table_column-count
then
...
..
.while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{$c = count($data); // get count of columns
$table = "table_$c"; // concat table name
$sqldata = ""; // empty sting for concatenation below
foreach($data as $dat)
$sqldata .= ', "'.msql_real_escape_string($dat).'"'; // convert $data into csv of quoted escaped values$sqldata = substr($sqldata,2); // remove first space and comma ", "
if($c > 0 and $c <= 22)mysql_query("insert into $table values ($sqldata)", $connection);
if($c ==12)echo "YIPEEEEE";
}if($c > 22 or $c == 0)echo "Call your DBA - Mark";
Ashford K.
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
--
---------------------------------------------------------------------
Thea Maina
Nairobi Kenya
http://www.mafans.com
skype: thea.mnairobi
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general