Wednesday, September 21, 2011

How do i add a table or something to my site so i dont have to always change it on each site?

I need to add something to my website that will change througout the website not just the first page



Iam doing a sports site and iam putting up a ladder on the left side in a table and also its going to be on all the pages, but i dont want to edit every single page twice a week, how can i use one file or something to add to it so i only have to edit one thing and it will all change?



ThanksHow do i add a table or something to my site so i dont have to always change it on each site?
You need to consider a database, mysql is best, and use php to build the dynamic part of the page from this data. So for a table giving results you need to build yourself an input page for the data (only for your use) and a script to read and display the query results. something like :

$result = mysql_query (';select result1,result2,result3 from result_table where id = '$person_id'';);

while ($record = mysql_fetch_array($result)){

$display_string .=';%26lt;td%26gt;//or however you want to show it

$record[result1]


$record[result2]


$record[result3]


%26lt;/td%26gt;';;}

By using then .= you can add to the string for as many lokups as you like then use :

%26lt;?php

echo $display_string;

?%26gt;

I have not gone into database connections as they vary depending on the system.How do i add a table or something to my site so i dont have to always change it on each site?
You *really* need to switch to a CMS for your websites.



But without switching, you can solve *that* particular problem with server side includes.

No comments:

Post a Comment