Hi all,
The below query is echoed out as...
INSERT INTO test values(,'902','05/07/2006','UIL','Stock','G55','5 for 3');
How do I prevent the comma separator at the very front as my query wont work with it there.
Below is the PHP code...thanks.
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>\n";
$row++;
$query = "INSERT INTO test values(";
for ($c=0; $c < $num; $c++)
{
//echo $data[$c] . "<br />\n";
$query .= ",'".$data[$c]."'";
//echo $query.'<br />';
//$result = mysql_query($query) or die(mysql_error());
}
$query .= ');';
echo '<p>'.$query.'</p>';
}