Closed Thread Icon

Topic awaiting preservation: May I borrow your eyes? (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12480" title="Pages that link to Topic awaiting preservation: May I borrow your eyes? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: May I borrow your eyes? <span class="small">(Page 1 of 1)</span>\

 
mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 10-19-2002 20:09

php code

I think the code is fairly self explanatory, but just to be sure:
part one = connect to database and check for empNum and password match (passed from login page).
part two = if log-in successful, begin session, set variable 'empSec'.
part three = check what time it is, check who logged in, set $greeting and $name appropriately
(Up to here, works like a charm)
part four = display any possible supervisor/emloyee relationships in the empreview db.
(This part works none so good.)

If the CEO logged in, he would see:

Vice-Pres I
Manager I
Supervisor I
Employee I
Employee II
Employee III
Employee IV
Supervisor II
Employee I
Employee II
Manager II
Supervisor I
Employee I
Employee II
Employee III
Supervisor II
Employee I
Employee II
Employee III
Vice-Pres II
....etc...
for the entire company.

If a manager logged in, she would see the relationships from her point in the chain, down.

My php error says parse error on line 145 (last line -- "</html>").

Help?

Thanks.
Your PHP dummy,
mobrul


mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 10-19-2002 21:16

Upon further investigation it seems I forgot a }.
Thank you anyway.

synax
Maniac (V) Inmate

From: Cell 666
Insane since: Mar 2002

posted posted 10-19-2002 22:51

can I have my eyes back now?

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 10-19-2002 23:07

Well, I am a relatively inexperienced PHP programmer, so if you can tell me a better/faster/cleaner way to do what I'm trying to do, I wouldn't mind borrowing them for a bit longer.
Other than that, they're all yours.



[This message has been edited by mobrul (edited 10-19-2002).]

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 10-19-2002 23:30

I'm quite inexperienced myself, but one *small* thing I would recommend is using a Switch() instead of an if() for simple things like the greeting bit. It's faster and easier.

Other than that I can't help any =)

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-20-2002 09:04

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 10-20-2002 11:37

well, I'm not 100% sure about php, but I know that in Pascal switch() (or case() as they call it) is, if used properly, many times faster than an if.
And even in php, once you break out of a switch, the remaining conditions will not be evaluated. Sure, you can achieve that with an if else if type of construct. But it's but ugly.
(Hey, doesn't java not have a switch construct at all. Polymorphism is usually the way to go ;-) )

so long,

Tyberius Prime

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-20-2002 12:32

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 10-20-2002 16:44

I've always read and been told that switch was faster.

I'm certainly no expert though.

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 10-20-2002 20:51

I'm no expert, but I've been told by more learned friends that if is faster for small chains, but switch is faster on larger chains. But that is in C++, might be different in PHP.

_________________________
Anyone who has lost track of time when using a computer knows the propensity to dream, the urge to make dreams come true and the tendency to miss lunch.
- copied from the wall of cell 408 -

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 10-21-2002 14:54

All this controversy...and started with a stupid missing }.
Somehow I feel important.
Thanks for the input. I do appreciated it.
InI, I'd be interested in the results of your tests when you are finished.
So which really is faster; the switch or the if...else?
The mystery continues.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-21-2002 15:29

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 10-21-2002 17:49

Very Interesting. Thanks Ini =)



bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 10-21-2002 19:41

I was going to ask how he benchmarked his results but I found the source code for that test here





.:[ Never resist a perfect moment ]:.

« BackwardsOnwards »

Show Forum Drop Down Menu