Ok, so I have a massive file of information, now FIND AND REPLACE techniques do not work, so making a PHP script, should. Now I have the information like so (exactly how it is in the file)
Code: Select all
id<br>
name<br>
title<br>
album<br>
year<br>
id<br>
name<br>
title<br>
album<br>
year<br>
id<br>
name<br>
title<br>
album<br>
year<br>Code: Select all
mysql_query("INSERT INTO listings VALUES('','','','','')");I need to find a solution by midday today at the latest, any ideas please??
Note 1: The <br> tags are in the file.
Note 2: The insert command will insert the information from every 5 lines.
---
I got a reply of:
And I replied...You can easily modify this to fit what you need.
Of course, if it's a file. Just change the $string variable toCode: Select all
<?php $string ="id<br> name<br> title<br> album<br> year<br> id<br> name<br> title<br> album<br> year<br> id<br> name<br> title<br> album<br> year<br>"; $string = explode("<br>", $string); $x=1; foreach($string AS $alone){ echo $alone . " "; if($x == '5'){ echo "<br>\n"; $x=0; } $x++; } ?>
My results were:Code: Select all
$string = file_get_contents('file.txt');
Code: Select all
id name title album year id name title album year id name title album year
But nothing since then, anyone got anymore help please?? Thank you.But how would I get them into a mysql_query command? I've tried $string[0] and $alone[0]but none have worked.