PDA

View Full Version : help with php code


meow
11-21-2004, 06:24 PM
can anyone help me please?
i tried to make a code which will bring me to, for example, "files/updates.php" if i type in "main.php?updates"
but when i tried to access the page it says "Parse error: parse error, unexpected T_STRING in /home/lovingff/public_html/main.php on line 13"

this is the code of my main.php:
<?php $page = basename($_SERVER['QUERY_STRING']);
include('files/top.inc');

if(!$page){
include('files/updates.php');
} else {
if(file_exists('files/'.$page.'.php')){
* * * include('files/'.$page.'.php');
} else {
* * * include('404.shtml);
*}
}
include('files/bottom.inc');
?>

and this is the code of my files/updates.php,

<? include('top.inc'); ?>
blah blah blah today....
<? include('bottom.inc'); ?>

anyone help me please!!! :o :D

688206002
11-21-2004, 06:30 PM
You can read my Dynamic URL tutorial here:

http://www.hostmatrix.org/forum/index.php?showtopic=338


If you have further questions, feel free to PM me :)

Terminator
11-21-2004, 06:34 PM
Don't PM him, ask it here. So that more people will know abt that particular problem.

Also which on is line 13 there? Is it the include() thing?

meow
11-21-2004, 06:40 PM
thank you Numbie :D
i've read your tutorial before but i want to try main.php?blah instead of something like main.php?view=blah

can you help me please :) :) ??? pleaaaseeeee

to Termy: yes, it's that include() thing :(

688206002
11-21-2004, 06:44 PM
Gee, now you have me confuzzled :P
I see main.php?view=blah all the time but as for main.php?blah I have no clue. Is that even possible? (Well, it probably is if you're asking about it... where did you see a site like this?)

Terminator
11-21-2004, 06:56 PM
It is possible, i think by the way she proceeded. But ff, its advisable that you use ?page=blah format, as its more reliable.

But the prolem with your code is what i am trying to figure out. Your 13 th line is just fine. Then how come it show such and error? Number any guess?

688206002
11-21-2004, 07:03 PM
Oh, the prob is not on the 13th line Terminator, it's on the 10th

She missed a ' after 404.shtml :P



EDIT:
But yes, the view=blah method is much more preferable IMHO :)

Terminator
11-21-2004, 07:10 PM
cool number. Fantastic debugging. I dint even noticed that. I was just keeping my eyes busy around line 13. I must had paste that code in Dreamweaver bfre debugging. The sytax highlighting wud have soptted it right on.

Any way cool.

meow
11-21-2004, 07:21 PM
yeah!!! i've made it!!! :D
thanks Numbie & Termy :)

cant believe i made such a stupid mistake :P

mahangee
11-21-2004, 07:25 PM
Tell me about it I HATE TYPO's. I spent 30mins looking for an error in my PHP once. Because my form wasnt posting (excuse the pun) properly, it turn out in my HTML I typed menthod= instead of method=. I was so pissed off at the end, but afterwards you feel so happy with yourself for figuring it out.

reid315
11-21-2004, 08:16 PM
Originally posted by mahangee@Nov 21 2004, 12:25 PM
Tell me about it I HATE TYPO's. I spent 30mins looking for an error in my PHP once. Because my form wasnt posting (excuse the pun) properly, it turn out in my HTML I typed menthod= instead of method=. I was so pissed off at the end, but afterwards you feel so happy with yourself for figuring it out.
9995


unlike html and css, php glares at you when there's an error, points at you when there's a problem, and php is a very strict language. maybe those of the C,C+ (or C++?) caliber are even stricter. I'm not sure, but i dont want to program something any more complicated than PHP.