Thank you for reading my post! I hope that you have a kind heart and decide to assist me. This is a PHP question about a MySQL problem, so I wasn't sure where to go to post this.
I'm kind of new to coding, but I'm working on an extension to update an old script. I have a lot of data that is saved in a format that I really don't like.
Okay, the old database structure had two columns, one with userid, and the other with an imploded array separated by '|'. On the left, a person's userid number, and on the right, all their favorite stories on the site.
id
favs
45
105|81
What I want to do is break up these arrays so the table looks like this:
id
favs
45
105
45
81
My problem is that I'm not sure how to convert the existing data
while($row = mysql_fetch_array($result)){
echo $row['uid']."<br />";
print_r (explode("|",$row['favs]));
echo "<br />";
}
That will print what I want to do, but I don't know how to get that into the database.