Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [rajani] Import problems: L2S2.pm to Links SQL v2.0.5: Edit Log

Here is the list of edits for this post
Re: [rajani] Import problems: L2S2.pm to Links SQL v2.0.5
Hello!

I need help to get the Category ID and insert them into Catlinks. The most likely area would be the following code in the L2S2.pm

------------existing-----------

else {
mild_warning("Not enough information to add a user for link `".($$row[0] or '<unknown>')." (URL: ".($$row[1] or "<none>")."). Setting link owner to `admin'");
$username = 'admin';
}
------------existing-----------

if ($insert_link_sth->execute($id,$username,'Yes',$date,$date,@$row)) {
for my $cat_id (@cat_ids) {

for (@cat_ids) {
my ($father_full) = m[\A(.*)/];
my $father_id;
if ($father_full) {

$get_cat_id_sth->execute($father_full) or critical "Unable to execute query `SELECT ID FROM ${e_prefix}Category WHERE Full_Name = ?': ".$get_cat_id_sth->errstr;

$father_id = $get_cat_id_sth->fetchrow_array;
}

my $cat_links_sth = $e_dbh->prepare("INSERT INTO ${e_prefix}CatLinks (LinkID, CategoryID) VALUES (?, ?)") or critical("Unable to prepare query `INSERT INTO ${e_prefix}CatLinks (LinkID, CategoryID) VALUES (?, ?)': ".$e_dbh->errstr);

$cat_links_sth->execute($id,$cat_id) or warning "Unable to execute query of xxx `INSERT INTO ${e_prefix}CatLinks (LinkID, CategoryID) VALUES (?, ?)': ".$cat_links_sth->errstr;

$num_of_links[$cat_id]++;
}
}


What it needs to do is to

- make a query in the table and return the Category ID and Father ID.

- This needs to be equal to the Category of the link being imported.

- Insert into the CatLinks table.

Any ideas?

Last edited by:

rajani: Nov 26, 2001, 9:52 AM

Edit Log: