Results 1 to 8 of 8
-
17th Jan 2011, 02:36 AM #1OPMember
Anyone Who Knows PHP Programing
I like to use a php function to switch between ON and OFF automatically upon the call.
Of course something simple like
$condition="OFF";
switch ($condition) {
case "OFF" :
$condition="ON";
break;
case "ON" :
$condition="OFF";
break;
}
this always returns ON but that is not what I need. How can I make it so that it remember the previous setting of $condition and act accordingly so it alternate between ON/Off automatically upon the call to the function?
ThanksTigger Reviewed by Tigger on . Anyone Who Knows PHP Programing I like to use a php function to switch between ON and OFF automatically upon the call. Of course something simple like $condition="OFF"; switch ($condition) { case "OFF" : $condition="ON"; break; case "ON" : $condition="OFF"; Rating: 5
-
17th Jan 2011, 03:02 AM #2MemberWebsite's:
ExpresShare.comit's not the proper section to post such a thread just PM a mod to move it to its proper section.
anyway you need to check before putting off into $condition the first time if it's set or not.
if it's not set the put off in it else(it already has a value) then nothing to do.
-
20th Jan 2011, 07:35 AM #3OPMember
that is a good idea; thank you dermechove.
-
20th Jan 2011, 08:40 AM #4mmm mmm!
Moved to development area
HATERS GONNA probably bring up some valid points considering I am an ignorant little twat so far up my own ass that i blame my problems on everyone and if you criticize me you're automatically wrong.
-
20th Jan 2011, 01:50 PM #5MemberWebsite's:
sborg.usTried using single quotes?
Strings give a hell lot of trouble when used in switch-case statements. Try
PHP Code:$condition="OFF";
switch ($condition) {
case 'OFF' :
$condition="ON";
break;
case 'ON' :
$condition="OFF";
break;
}
I hope that helps.
-
20th Jan 2011, 02:32 PM #6Member
you need to store the $condition to session, cookie or database
and the initial value should be retrived from there, it is hard coded in your script...
-
20th Jan 2011, 10:03 PM #7MemberWebsite's:
litewarez.net litewarez.com triniwarez.comPHP Code:
session_start();
$status = isset($_SESSION['status']) ? $_SESSION['status'] : "OFF";
switch($status)
{
case "ON":
$status = $_SESSION['status'] = "OFF";
break;
case "OFF":
$status = $_SESSION['status'] = "ON";
break;
}
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
21st Jan 2011, 06:53 PM #8MemberWebsite's:
litewarez.net litewarez.com triniwarez.comJoin Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Programing services
By dropboks in forum Completed TransactionsReplies: 0Last Post: 11th Mar 2012, 08:16 PM -
what programing language needed to code a bot
By YOUSEFN in forum General DiscussionReplies: 1Last Post: 25th Jan 2012, 04:16 PM -
Some help need in Java programing
By bapi21 in forum Web Development AreaReplies: 1Last Post: 10th Jul 2011, 01:08 PM -
TCP / Ip programing ?
By CatchItBaby in forum Web Development AreaReplies: 2Last Post: 8th Jul 2010, 02:38 PM
themaPoster - post to forums and...
Version 5.38 released. Open older version (or...