Kylo Posted October 4, 2006 Share Posted October 4, 2006 I have been doing a lot of google searching and such but still havent be able to come up with anything to help me with what I need, and I finally found this site and decided I will post to see if anybody can help. I am currently trying to code my clan site (best viewed in IE, Firefox hates me), and I am trying to find a way to make information update itself on multiple pages by only changing it on one. I know this can be done, cause I have seen it mentioned, but never seen any code. I dont know php or how to make or code a database. So all the more help, the better I can understand to help someone else if needed.Alright, my test site is www.nwn2world.com/Veneratio2The information I want to update on all pages is the "Latest Demos", "Latest Matches" and "Veneratio Misc." Boxes. (Again, please view in IE for best results atm) Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/ Share on other sites More sharing options...
fenway Posted October 4, 2006 Share Posted October 4, 2006 I don't know what you mean. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-103983 Share on other sites More sharing options...
Kylo Posted October 4, 2006 Author Share Posted October 4, 2006 What I wana do is make it so if I changed the "Latest Demos" section on the index.html it will automatically change the other .html pages like roster.html, sponsors.html and so forth. This way I dont have to manually edit each page by itself. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-103996 Share on other sites More sharing options...
fenway Posted October 4, 2006 Share Posted October 4, 2006 Well, yes, that's going to require centralized content... usually in a DB, though there are all sorts of ways to cheat. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104002 Share on other sites More sharing options...
Kylo Posted October 4, 2006 Author Share Posted October 4, 2006 okay, which is the easiest way, cause I aint the hotest with DBs and such. Which code would I insert into those cells. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104007 Share on other sites More sharing options...
fenway Posted October 5, 2006 Share Posted October 5, 2006 It's not so simple... if you want dynamic content that's MySQL / PHP driven, you're definitely on the correct website ;-) But it's not just a cut-and-paste job. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104492 Share on other sites More sharing options...
Kylo Posted October 5, 2006 Author Share Posted October 5, 2006 well, I have created a database and a table within the db called demos.... trying to get this code to work in my .html page now... I tried this...<?php $db = mysql_connect("localhost", "root", ""); mysql_select_db("nwn2wor_veneratio",$db); $result = mysql_query("SELECT * FROM `demos` WHERE 1`demo1``demo2``demo3``demo4``demo5`",$db); echo "<TABLE>"; while($myrow = mysql_fetch_array($result)) { echo "<TR><TD>"; echo $myrow["demo1"]; echo "<TR><TD>"; echo $myrow["demo2"]; echo "<TR><TD>"; echo $myrow["demo3"]; echo "<TR><TD>"; echo $myrow["demo4"]; echo "<TR><TD>"; echo $myrow["demo5"];} echo "</TABLE>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104494 Share on other sites More sharing options...
JayBachatero Posted October 5, 2006 Share Posted October 5, 2006 You have to rename your .html page to .php for it to be parsed. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104499 Share on other sites More sharing options...
Kylo Posted October 5, 2006 Author Share Posted October 5, 2006 Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/nwn2wor/public_html/Veneratio2/index.php on line 113this is what I got back, but if I am going to have to put in my user and password... cant someone steal that? Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104516 Share on other sites More sharing options...
JayBachatero Posted October 5, 2006 Share Posted October 5, 2006 No that won't be shown to the browser. The browser will see what ever is echoed to it. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104523 Share on other sites More sharing options...
Kylo Posted October 5, 2006 Author Share Posted October 5, 2006 alright... I am trying this but getting a parse error...[code]<?php $db = mysql_connect("localhost", "******", "********"); mysql_select_db("nwn2wor_veneratio",$db); $result = mysql_query("SELECT * FROM `demos`",$db);or die("Query failed: $sql<br />".mysql_error()); if(!mysql_num_rows($result)) { echo "No results returned by query $sql"; }else {"<TABLE>"; while($myrow = mysql_fetch_array($result)) { "<TR><TD>"; $myrow["demo1"];"</TR></TD>"; "<TR><TD>"; $myrow["demo2"]; "</TR></TD>";"<TR><TD>"; $myrow["demo3"]; "</TR></TD>";"<TR><TD>"; $myrow["demo4"];"</TR></TD>";"<TR><TD>"; $myrow["demo5"];"</TR></TD>";} "</TABLE>"; ?>[/code]also... cant someone just view source and see the login/password?mod edit : security data removed and code tags added Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104525 Share on other sites More sharing options...
JayBachatero Posted October 5, 2006 Share Posted October 5, 2006 No not when php parses it. You should remove the password from your post though. What I meant was that when you put it on your site and PHP parses it won't be shown. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104528 Share on other sites More sharing options...
Barand Posted October 5, 2006 Share Posted October 5, 2006 If someone tries to view a php page all they see is the generated HTML output.However, you could/should put the security data in an include file located outside the web root directory tree for added security. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104530 Share on other sites More sharing options...
JayBachatero Posted October 5, 2006 Share Posted October 5, 2006 Ok this should work for you.[code]<?php$db = mysql_connect("localhost", "******", "******");mysql_select_db("nwn2wor_veneratio",$db);$result = mysql_query("SELECT * FROM `demos`",$db) or die("Query failed: $sql".mysql_error());if(!mysql_num_rows($result)) echo "No results returned by query $sql";else{ echo ' <TABLE>'; while($myrow = mysql_fetch_assoc($result)) { echo ' <TR> <TD>', $myrow["demo1"], '</TD> <TD>', $myrow["demo2"], '</TD> <TD>', $myrow["demo3"], '</TD> <TD>', $myrow["demo4"], '</TD> <TD>', $myrow["demo5"], '</TD> </TR>'; } echo ' </TABLE>';}mysql_free_result($result);?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104531 Share on other sites More sharing options...
Barand Posted October 5, 2006 Share Posted October 5, 2006 So much for reporting his post re password inclusion :/ Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104533 Share on other sites More sharing options...
Kylo Posted October 5, 2006 Author Share Posted October 5, 2006 what u mean Barand? Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104535 Share on other sites More sharing options...
JayBachatero Posted October 5, 2006 Share Posted October 5, 2006 [quote author=Barand link=topic=110531.msg447491#msg447491 date=1160078443]So much for reporting his post re password inclusion :/[/quote]I realized that I forgot to edit that after I posted. I edited the post right away though. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104537 Share on other sites More sharing options...
Kylo Posted October 5, 2006 Author Share Posted October 5, 2006 ahhh, its all good, I delete that db user and created a new one with new password.I got the code to work by tweaking the table to this.. { echo ' <TR> <TD>', $myrow["demo1"], '</TD></TR> <TR> <TD>', $myrow["demo2"], '</TD></TR> <TR> <TD>', $myrow["demo3"], '</TD></TR> <TR> <TD>', $myrow["demo4"], '</TD></TR> <TR> <TD>', $myrow["demo5"], '</TD></TR> </TR>'; }and now the it looks perfect on my site, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104538 Share on other sites More sharing options...
Kylo Posted October 5, 2006 Author Share Posted October 5, 2006 just one last question.... if I wanted to link one of those demo1 or demo2 to a file to download, what would I do to edit the code? Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104541 Share on other sites More sharing options...
Barand Posted October 5, 2006 Share Posted October 5, 2006 Store[code]<?php$db = mysql_connect("localhost", "username", "password");mysql_select_db("nwn2wor_veneratio",$db);?>[/code]in a file called, say, "connect.inc.php" and store that on the server outside the web root directory tree.In you scripts that need to acces the db[code]<?phpinclude 'connect.inc.php';?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23024-linked-pages/#findComment-104550 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.