Nymphetamine Posted August 11, 2008 Share Posted August 11, 2008 ??? Hi guys, Can't believe I'm having to write a topic for such a newbie question but I couldn't find anything on the net or even think of what to search for... I want it so that... if (suchandsuch) $this = "that" AND echo "something"; How do I get an if statement to do two things? I tried "&&" and various things but didn't work haha... Sorry for being such a noooob >.< Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/ Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 I'm not quite following you... Sorry. Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/#findComment-613339 Share on other sites More sharing options...
waynew Posted August 11, 2008 Share Posted August 11, 2008 if (suchandsuch){ $this = "that"; echo "something"; } Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/#findComment-613342 Share on other sites More sharing options...
Nymphetamine Posted August 11, 2008 Author Share Posted August 11, 2008 I want the first "if" to do two different things... if ($number=="1") echo "Something" + $something = "something else"; elseif ($number=="2") etc... Not... if ($number=="1") echo "Something"; elseif ($number=="2") etc... waynewex - I tried that and it doesnt work... Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/#findComment-613350 Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 Well, waynewex was spot on then... if($number == 1){ echo "The number is 1"; $var = "Something"; }elseif($number == 2){ echo "The number is 2"; $var = "Something else..."; } Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/#findComment-613351 Share on other sites More sharing options...
waynew Posted August 11, 2008 Share Posted August 11, 2008 You're doing something wrong somewhere else. What is given to this IF statement? And what do you plan to do? Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/#findComment-613352 Share on other sites More sharing options...
Nymphetamine Posted August 11, 2008 Author Share Posted August 11, 2008 Oops! Forgot the lil "{" haha Thanks! Link to comment https://forums.phpfreaks.com/topic/119119-solved-and/#findComment-613354 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.