I am getting a parse error now \\Can anyone see an issue
Thanks for your help
PHP Code:
<?
# first get a mysql connection as per the FAQ
$link = mysql_connect('localhost', 'topselec_jt', 'bucket');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db('topselec_data', $link);
if (!$db_selected) {
die ('Can't use foo : ' . mysql_error());
}
$fcontents = file ('./topscsv.csv');
# expects the csv file to be in the same dir as this script
for($i=0; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
#if your data is comma separated
# instead of tab separated,
# change the 't' above to ','
$sql = "insert into $table values ('".
implode("','", $arr) .")";
mysql_query($sql);
echo $sql ."<br>n";
if(mysql_error()) {
echo mysql_error() ."<br>n";
}
}
?>