Help! Small Bug on my PHP Script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Subfusion
Forum Newbie
Posts: 18
Joined: Mon Aug 15, 2005 6:53 am
Location: Spain

Help! Small Bug on my PHP Script

Post 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!
Last edited by Subfusion on Sun Dec 10, 2006 12:10 pm, edited 3 times in total.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

Please specify your problems in details.
Subfusion
Forum Newbie
Posts: 18
Joined: Mon Aug 15, 2005 6:53 am
Location: Spain

Post 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 :)
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Seems like that could be solved pretty simply with an if statement. (by the way, very nice design)
Subfusion
Forum Newbie
Posts: 18
Joined: Mon Aug 15, 2005 6:53 am
Location: Spain

Post 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...
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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?
Subfusion
Forum Newbie
Posts: 18
Joined: Mon Aug 15, 2005 6:53 am
Location: Spain

Post 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?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
Subfusion
Forum Newbie
Posts: 18
Joined: Mon Aug 15, 2005 6:53 am
Location: Spain

Post by Subfusion »

I managed to sort it out with the following as well:

Code: Select all

if (!$a and !$v) {
Thanks!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Subfusion wrote:I managed to sort it out with the following as well:

Code: Select all

if (!$a and !$v) {
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().
Post Reply