How to control a network of links?

Discussion in 'PHP' started by TravisReynolds, May 13, 2008.

  1. #1
    I use to take a PHP class a long time ago, but I have not really used it.


    I am controlling like a bunch of websites, and I want to add links to all of them. How do I set it up so that when I just add a link to like the database or whatever, they will all be updated? I do not have to do it manually?

    Also How do I set up the database?
     
    TravisReynolds, May 13, 2008 IP
  2. swordbeta

    swordbeta Banned

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Simply use the same database for all websites and echo them.
     
    swordbeta, May 13, 2008 IP
  3. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What he said.

    As far as setting up the database, just set up the database through cPanel (if you've got it), and use phpmyadmin and create a table in the database with your desired columns.
     
    Altari, May 13, 2008 IP
  4. juust

    juust Peon

    Messages:
    214
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    if you have your sites on multiple domains, you cannot use the same mysql database, in that case i'd go for an xml solution:
    * set up an old version of phplinkdirectory on one site and maintain your links in it
    * write a phpscript to dump the links to an xml file
    * use simpleXml from other sites to request that xml-page, parse and list the links
     
    juust, May 13, 2008 IP
  5. swordbeta

    swordbeta Banned

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Why?
    If your using multiple domains change localhost with the host when connecting to mysql db
     
    swordbeta, May 13, 2008 IP
  6. juust

    juust Peon

    Messages:
    214
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I didnt get that one to work a while back, I figured I'd use XML instead. but if it normally works i stand corrected.
     
    juust, May 13, 2008 IP
  7. tomazinis

    tomazinis Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You can insert iframe with links page in to your websites. Then you need update just one page.
     
    tomazinis, May 14, 2008 IP
  8. msaqibansari

    msaqibansari Peon

    Messages:
    84
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Use following code

    
    <?php
    $db[] = array("host"=>"host1", "user"=>"user1", "pwd"=>"paassword1", "dbname"=>"db1");
    $db[] = array("host"=>"host2", "user"=>"user2", "pwd"=>"paassword2", "dbname"=>"db1");
    $db[] = array("host"=>"host3", "user"=>"user3", "pwd"=>"paassword3", "dbname"=>"db1");
    $db[] = array("host"=>"host4", "user"=>"user4", "pwd"=>"paassword4", "dbname"=>"db1");
    
    foreach ($db as $info)	{
    	$link = mysql_connect($info["host"], $info["user1"], $info["pwd"]);
    	mysql_select_db($info["dbname"], $link);
    	mysql_query("Update link", $link);
    	mysql_close($link);
    }
    ?>
    
    Code (markup):
     
    msaqibansari, May 14, 2008 IP
  9. TravisReynolds

    TravisReynolds Guest

    Messages:
    353
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    alright guys, thanks for all the input :)
     
    TravisReynolds, May 14, 2008 IP