That looks more like it 😊
There are too many results to post, I’ve out them in the attached file.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 12, 2007 10:38am
Subscribe [4]#16 / Jul 12, 2007 12:31pm
That looks more like it 😊
There are too many results to post, I’ve out them in the attached file.
#17 / Jul 12, 2007 12:38pm
I’ve got rid of
Notice: Undefined index: Genre in /home/tripewri/public_html/smg/core/core.functions.php(635) : eval()‘d code on line 31
INSERT INTO `exp_category_posts` (`cat_id`, `entry_id`) VALUES (’‘, ‘813’)
It had imported the Field Titles as an entry. I’ve deleted that row from the databse.
#18 / Jul 12, 2007 12:53pm
Cool- then we’re good to go. You should always backup, yada yada before messing with the db like this. Proceed at your own risk- etc. But- we’re just inserting into the exp_category_posts table. So- IF you don’t already have data in there, we can just truncate the table if it goes wrong. If you do have data in that table- I’d go ahead and just backup that table seperately. Then- we just need to add one line and this will actually insert the info:
$i = 0;
foreach($entry_data as $key => $val)
{
$cats = explode(';', $val);
foreach($cats as $cat_val)
{
$data = array('cat_id' => $cat_array[trim($cat_val)], 'entry_id' => $key);
$sql = $DB->insert_string('exp_category_posts', $data);
$DB->query($sql);
$i++;
}
}
echo 'Done: '.$i;That will loop through and actually perform all of those queries we were echoing out. Then I’d recount stats and see if it worked.
It may possibly time out- in which case we’d need to drop the table and re-run this in a couple of batches. But they’re pretty simple queries, so hopefully it will go through first time.
Note- ONLY load this page once. It should show ‘Done: 55’ or something- however many queries got run. Once it worked, delete the template so you don’t accidentally run it again.
Let me know how she goes- and do backup before playing.
#19 / Jul 12, 2007 12:57pm
Just to make sure I’m clear - I add the above script to what is already in the test template?
#20 / Jul 12, 2007 1:07pm
Hurray - it worked! If you ever make it to Yorkshire I owe you a pint or 10 :D
#21 / Jul 12, 2007 1:10pm
Woot! If I ever make it to Yorkshire, I’ll take you up on it!
Keep an eye on things, but I think you should be solid. The entry/cat tie-in is pretty straightforward.