Page 1 of 1
Help! Small Bug on my PHP Script
Posted: Sun Dec 10, 2006 4:13 am
by Subfusion
Last night I started to code a small order system for my website and I'm having a small problem that I can't manage to fix.
If you take a look at my orders backend all the pages seem to work fine but when you view a particular order, for some reason I get the "Home" screen at the bottom when viewing a single order; when viewing an order I don't want the "Welcome to..." bit and below that to appear. This is happening when you view all orders.
My code is looking like this:
How can I fix this?
---------------------------------------------
Issue Solved!
Posted: Sun Dec 10, 2006 4:33 am
by dibyendrah
Please specify your problems in details.
Posted: Sun Dec 10, 2006 4:54 am
by Subfusion
dibyendrah wrote:Please specify your problems in details.
Take a look at the
orders homepage, beside the navigation there's some HTML and it lists the Pending orders. Now when you look at an
individual order you get that HTML and Pending orders bit below the information of the order, that isn't supposed to go there.
What I want to know is how I can fix it?
Thanks

Posted: Sun Dec 10, 2006 10:21 am
by aaronhall
Seems like that could be solved pretty simply with an if statement. (by the way, very nice design)
Posted: Sun Dec 10, 2006 11:20 am
by Subfusion
aaronhall wrote:Seems like that could be solved pretty simply with an if statement. (by the way, very nice design)
Yes, but which if statement? I have no idea...
Posted: Sun Dec 10, 2006 11:31 am
by aaronhall
the only if statement that I know of takes a list of conditions and runs the code inside the brackets only of those conditions have been met. Under what conditions do you want that part of the page to display? How would you translate that into a list of conditions for your if statement?
Posted: Sun Dec 10, 2006 11:35 am
by Subfusion
aaronhall wrote:the only if statement that I know of takes a list of conditions and runs the code inside the brackets only of those conditions have been met. Under what conditions do you want that part of the page to display? How would you translate that into a list of conditions for your if statement?
The pages that have $v and $a have the conditions; if $a or $v is not met or none of these conditions are requested then display that bit (The one that says "Welcome to...."). That's what I'm trying to achieve
How can I do that?
Posted: Sun Dec 10, 2006 11:50 am
by aaronhall
You might check out
this tutorial on conditional statements in PHP -- also, the
empty function would be helpful in checking if $v or $a have been set.
Posted: Sun Dec 10, 2006 12:09 pm
by Subfusion
I managed to sort it out with the following as well:
Thanks!
Posted: Sun Dec 10, 2006 12:15 pm
by John Cartwright
Subfusion wrote:I managed to sort it out with the following as well:
Thanks!
This will throw notices if those variables wern't initialized.. you definantly should consider turning on
error_reporting(E_ALL); aswell as using
isset() or
empty().