NameSilo

SQL Affiliates

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

Danaldinho

Established Member
Impact
0
I have created a couple of fansites now on my favourite music artists and I do the menu on the left hand side of the page. You can see the menu on one of them here: http://www.chamillionairechat.com

Anyway I am getting more and more people who want to affiliate with me and it takes me a long, long time to add their link into the box as there is hundreds of pages like all the lyrics page.

Anyway I was just wondering is it possible for me to do this a quicker way by using SQL

I haven't really used it before except for some phpbb mods

Thanks, Daniel Mousdell :)
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You can also use PHP Include function and include one other php file with ads code in all the rest of the pages.
 
0
Close
-Nick- said:
You can also use PHP Include function and include one other php file with ads code in all the rest of the pages.

Like an iframe?
 
0
Close
Nope it is not Iframe it is pure single page HTML output without an Iframe.

Search for PHP Include Function in google.

You will know exactly what to do :)

Thanks.
 
0
Close
Use this on your (php) page where you want to include the links:

Code:
<?php include("filename.php"); ?>


Here is a basic php script to connect to a mysql database, query, and display the links which would you put into filename.php:

Code:
<?php

# db vars
$dbuser = "dbuser"; # username
$dbpass = "dbpass"; # password
$database = "dbname"; # name of database
$dbhost = "localhost"; # usually localhost

# db connect
$dbh = mysql_connect($dbhost, $dbuser, $dbpass) || die ("Unable to connect to host");
$selected = mysql_select_db($database) || die ("Unable to select database");

# query
$query="SELECT url from [[tablename]]";
$result=mysql_query($query);
$numrows = mysql_numrows($result);
$i = 0;

while ($i < $numrows) {
  $url=mysql_result($result,$i,"url");
  echo "<a href=\"$url\">$url</a><br>";
$i++;
}

?>

Replace:

[[tablename]] = the table name that contains the url data
 
0
Close
0
Close
In order for the php code to be interpreted properly in most cases it must have a .php file extension. If you used the include() code above on your index.html...it will not work.
 
0
Close
Thanks mate, that worked brilliantly

Thanks again for your help :D
 
0
Close
Not a problem. Glad to be a help! :)
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back