Is there a way I can format a list so I can insert it via SQL?
My current list format is test:test
and I want to be able to format it so it will insert into my database.
INSERT INTO `test` (`user`, `file`) VALUES
('test', 'test'),
('test2', 'test2'),
('[email protected]', 'test3');
Is this possible by any chance?
<?
if($_POST['oldlist']){
$sql = "SELECT * FROM test WHERE user='$_POST[oldlist]'";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0) { echo "exists";} else {
$sqlq = "INSERT INTO test (`user` ,`file`)
VALUES ('$_POST[oldlist]');";
$add = mysql_query($sqlq) or die(mysql_error());
if($add){echo "done";}else {echo "failed";}
}}
?>
Something by that means? I want to be able to post a list and have it insert into my database, but it has to be formatted first.