#1
|
||
|
Need some help with db's
Well i'm not sure if its related with db's, but i'm making a website with PHP & Mysql, and i was woundering how you get something like "index.php?view=news", is it anything to do with connecting with db's, and can someone run through what i do to do this.
-Warm regards |
#2
|
||
|
Hi,
Its just a simple little bit of code that you have to enter into your page. When you slice up your website, Insert the line into the Main Content part, the part where everything is going to be opened. <? if(isset($page)) { include("$page.php"); } else { include("news.php"); }; ?> The main page will be news.php and it will do as so... index.php?page=news index.php?page=members index.php?page=results etc Hope this helps, Dane |
#3
|
||
|
RE
Thnx m8, that helped alot.
- Warm regards |
#4
|
||
|
Ooo a bit of a boo-boo here lol, erm it went wrong...
www.masterd.co.uk/fleabib-studios/uploadedsigs/bo-bo.jpg Thats what went wrong, and i can't spot any problems there :? |
#5
|
||
|
Hmm mate...
This is the code that you should enter.... <? if(isset($page)) { include("$page.php"); } else { include("news.php"); }; ?> You have entered.... <? if(isset($page)) { include("$index.php"); } else { include("test.php"); }; ?> ------------------ You have changed the $page.php with $index.php ... Change that back mate and keep it how it is... That should work... If you want to change anything change the "news.php" to whatever.php Then see if it works. Thanks Dane |
#6
|
||
|
Ahh thnx m8
|
#7
|
||
|
Also you could use this too, it will go into your index.php
<? if ($page == "") $page = "news"; if (!file_exists($page.".php")) $page = "error"; include($page.".php"); ?> if you want it to be ./?view=news then change the "page" with view, simple as Also, if a page doesnt exist when they try click a link, an error will appear |
#8
|
||
|
cool, thank you, i will try both methods
|
#9
|
||
|
oh and also, when making hyper links for it, all u have to do is put ./?page=link
thus when u click it, wont have index.php on it wots the website addy |
#10
|
||
|
a lil explanation of what your doing there...
basically your passing info like you wouldin a variable throught the url so... if you did /?action=insert then you did if(action=="insert"){ $result = mysql_query"INSERT INTO db VAULES()"; } it takes that info ... ... just a lil tell you what it is.. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
{DB} RECRUITING server | koutking | Gaming Talk | 0 | 10-09-2007 07:45 PM |
maps db | -Tigger- | phphq.Net Forums | 0 | 08-02-2007 06:54 AM |
Map DB | -Tigger- | Feedback / Novahq.net Support | 3 | 06-26-2004 04:19 PM |
db | staffy bull | Sigs and Graphics | 3 | 09-11-2003 12:33 PM |
Map db almost complete! | Scott | News | 0 | 05-10-2002 12:34 PM |