Let's say I have data that's something like this:
title:author:title2:autor2:title3:author3
How would I seperate it to have a database table populated with the authors in one column and its corresponding title in another?:confused:
Printable View
Let's say I have data that's something like this:
title:author:title2:autor2:title3:author3
How would I seperate it to have a database table populated with the authors in one column and its corresponding title in another?:confused:
This is how I'd do it. Although I ran that off the top of my head, it should work.PHP Code:$stuff = "title:author:title2:autor2:title3:author3";
$info = explode(":", $stuff);
$count = count($info);
for ($i = 0; $i < $count; $i++) {
if (even($info[$i] == 1) {
echo $info[$i];
} else {
echo " - " . $info[$i] . "<br>\n";
}
}
function even($var) {
return ($var % 2 == 0);
}