PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 307,175 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,595 people online right now. Registration is fast and FREE... Join Now!




In light of problem solving

 

In light of problem solving, I need a push

supersssweety

1 Nov, 2007 - 10:21 AM
Post #1

D.I.C Regular
Group Icon

Joined: 16 Mar, 2007
Posts: 340



Thanked: 3 times
Dream Kudos: 125
My Contributions
OK I have a big cluster...I am trying to get a new feature to our base product to work...here is the logic I have come up with...its pusedo

if preview is on OR approval engine is off
if savedetails throws an error
do stuff
else
set some variables
run save details
elseif approval engine is on AND preview is off
don't save details
set those same variables as above (redundant I know)


but I have nothing for else is that ok?
basically normal base behaviors is to save details if there is no error

but this client wants an approval first...so when we send it, we don't want to save it until it is approved. The problem is the title to display once you send it for approval or send it w/ base behavior depends on the variables set, so i need those in any case...unless there is an error in savedetails...

savedetails is run according to our coding standards like this:
CODE

if (false === ($new_id = $member_lead->SaveDetails(0, $info, "n")))


that new id is needed when preview is checked regardless is the approval engine is on or not

I am OK with this code...the redundant variable setting has been OKed its just...there is no else...is that ok??


User is offlineProfile CardPM
+Quote Post

 
Reply to this topicStart new topic
Replies(1 - 3)

supersssweety

RE: In Light Of Problem Solving

1 Nov, 2007 - 10:36 AM
Post #2

D.I.C Regular
Group Icon

Joined: 16 Mar, 2007
Posts: 340



Thanked: 3 times
Dream Kudos: 125
My Contributions
I am switching it to this:

if approval engine is on AND preview is off
don't save details
set those same variables as above (redundant I know)
else
if savedetails throws an error
do stuff
else
set some variables
run save details


User is offlineProfile CardPM
+Quote Post

skyhawk133

RE: In Light Of Problem Solving

1 Nov, 2007 - 11:25 AM
Post #3

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 16,883



Thanked: 156 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
You don't have to have an else, you can have as many elseifs as you'd like, but you don't have to have an else.

At least I don't think you do... hmmmm
User is offlineProfile CardPM
+Quote Post

supersssweety

RE: In Light Of Problem Solving

1 Nov, 2007 - 12:50 PM
Post #4

D.I.C Regular
Group Icon

Joined: 16 Mar, 2007
Posts: 340



Thanked: 3 times
Dream Kudos: 125
My Contributions
QUOTE(skyhawk133 @ 1 Nov, 2007 - 12:25 PM) *

You don't have to have an else, you can have as many elseifs as you'd like, but you don't have to have an else.

At least I don't think you do... hmmmm

well yeah...but it seems so...i dunno...scary..i gues it is the exact same as having an if {} but I am glad I was wondering about it cause the first example was wrong...it would have not done what I wanted...revering it...just putting the AND statement first and then just an else works beautifully smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 07:10PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month