Hi Rajani,
have just programmed another one to duplicate a link ;-)
Such small things are easy to do for a programmer, but i did it, too (in some hours ;-)
The problem to share it here, is that itīs very special to my needs.
But if you need it, i will send it to you via mail and give some advice i wanted.
or try this as basic information:
Code:
<?php
//SQL
// ---------------------------------
$sql_type = "mysql"; #sql_type
$sql_server = "localhost"; #sql_server
$sql_user = "******"; #sql_user
$sql_pass = "******"; #sql_pass
$sql_db = "****";
$sql_dbL = "Links"; #sql_db Links
$sql_dbCL = "CatLinks"; #sql_db Category
$data = "/***/***/data.txt"; #Path to data.txt
// Fields for my info
// ---------------------------------
$Lcols = "ID, Title, URL, LinkOwner,Add_Date,Mod_Date,Description,Contact_Name ,Contact_Email,
Hits, isNew, isChanged, isPopular, isValidated, Rating, Votes, Status, Date_Checked,
Timestmp, Aufmacher, Text, Link, HTML, Comment, Priority, Wertung, Detailed,
Logo, LogoG, Bild01, Bild02, Bild03, Bild04, Bild05, Media";
$CLcols = "LinkID, CategoryID";
$lncols = "ID,Title,URL,LinkOwner,Add_Date,Mod_Date,Description,Contact_Name,Contact_Email,
Hits,isNew,isChanged,isPopular,isValidated,Rating,Votes,Status,Text";
// Connect SQL
// ---------------------------------
@mysql_pconnect("$sql_server", "$sql_user", "$sql_pass")
or die ("No connect to server!");
@mysql_select_db("$sql_db")
or die ("No connect to db: $sql_db !");
// Get from ASCII
$datei = "$data";
$do = fopen($datei, "r")
or die ("Cant open $datei");
while ($zeile = fgets ($do,4096)):
list($catid, $short, $title, $text) = split('\|',$zeile); # DIVIDED BY -->|<-- !!!!!
I have only four fields to import and melt $short and $tilte to Title !!!
// Ltrim, Spaces Left not neccessary at all
$title = ltrim($title); $text = ltrim($text); $short = ltrim($short);
// Replace ' and "
$title = str_replace("'"," ",$title); $text = str_replace("'"," ",$text);
$title = str_replace("\"","",$title); $text = str_replace("\""," ",$text);
echo "$catid<br>$short - $title<br>$text<br><br>"; # for info
// -- MySQL ---------------------------
$query="INSERT INTO $sql_dbL ($lncols)
VALUES ('',
'$short - $title',
'http://','admin',
'2002-05-11',
'2002-05-11',
'',
'Name','name@domain.de',
'0','No','No','No','Yes','0.00','0','0',
'$text')";
$rs = mysql_query($query);
if ($rs){
echo "<b>$rs</b>"; echo "$query"; echo "<br><br>";
$newid = mysql_insert_id();
} else echo "Error!!!";
$query2="INSERT INTO $sql_dbCL (LinkID, CategoryID)
VALUES ('$newid','$catid')";
$rs2 = mysql_query($query2);
if ($rs2){ echo "<b>$rs2</b>"; echo "$query2"; echo "<br><br>";
}else echo "Error!!!";
endwhile;
fclose($do);
mysql_close();
?>
This was only to import some data from Excel, not to export/import old data from Links.
Itīs not really save or comfortable ...
BTW: If you have problems to export from Excel, do the following:
Change all cells to TEXT!
Save Excel !
Open Access
Import in a new table in a new db.
Then change the sight and change all fields to text or memo.
Export without index and divide with |, no "around" fields.
Itīs theoretical very easy, but every month i have to update 10.000 rows for a client on this way in an old Links 1.13 and while i do it sometimes in 5 minutes, i often stuck on small faults.
Problems like spaces before text, '"&%§$ and others.
But the next php to solve this too, is on the run ;-)
Do you mean "Adeva" ? You mean the old site for Links Mods?
Have just thought about if its worth to build up a new site to get some clients over GT,
while we have some big projects out, build with Links (and a lot of mods ;-)
Try this e.g.
http://www.dbl-ev.de Build with 4 times Links 1.13 and a lot of connection between.
The next generation is in work, still try to have different tables for different cats for additional data. But time is short and i have to do some hours more this night.
Robert