Jump to content

text file to mysql


astralaaron

Recommended Posts

You could try something like this:

$data = explode(',',$list_of_info);$numrows = count($data);$sql = 'INSERT INTO table_name VALUES ';$i = 1;foreach($data as $entry) {  $sql .= "('$entry')";  if($i<$numrows)	$sql .= ", ";  $i++;}if(!mysql_query($sql))  die(mysql_error());

That's assuming the data only has one value per entry. If not, it'll be more complicated than that.-Jason

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...