PHP scripting issue.

matt88e

New Member
Messages
13
Reaction score
0
Points
0
Ok here is the script

Just make up an Value for Reset_0[1-4]
Letters & Numbers. Numbers work fine. Its the Letters im having issues with. However if i echo the letter while running the WHILE command it seems to print the letters later on in the script in the output.

$reset_0[0]==="aaa";
$reset_0[1]==="bbb";
$reset_0[2]=="111";
$reset_0[3]=="222";

$i = 0;
while ($i <= 18):
if($reset_0[$i]===a){$reset_1[$i]="933"; echo $reset_1[$i];}
if($reset_0[$i]===A){$reset_1[$i]="588";}
if($reset_0[$i]===b){$reset_1[$i]="811";}
if($reset_0[$i]===B){$reset_1[$i]="433";}
if( empty($reset_0[$i])){$reset_1[$i]="";}

echo $reset_1[0];
echo $reset_1[1];
echo $reset_1[2];
echo $reset_1[3];

If anyone can help i'll be thankful
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
From what I can see you've missed out the "endwhile;" statement, and you've forgotten to auto increase $i

Try:
PHP:
$reset_0[0]==="aaa";
$reset_0[1]==="bbb";
$reset_0[2]=="111";
$reset_0[3]=="222";

$i = 0;
while ($i <= 18) :
if($reset_0[$i]===a){$reset_1[$i]="933"; echo $reset_1[$i];}
if($reset_0[$i]===A){$reset_1[$i]="588";}
if($reset_0[$i]===b){$reset_1[$i]="811";}
if($reset_0[$i]===B){$reset_1[$i]="433";}
if( empty($reset_0[$i])){$reset_1[$i]="";}
$i++;
endwhile;

echo $reset_1[0];
echo $reset_1[1];
echo $reset_1[2];
echo $reset_1[3];
 
Last edited:

matt88e

New Member
Messages
13
Reaction score
0
Points
0
Not the problem but thank for filling in the rest of the info i had on my PHP script.

so it still leaves me with the same problem. a or b input doesnt work later unless its echo'd within the while statement. & the increasing thing is there $i++.

im using the while statement to cut down on Multi scripting the same If statements over a bigger Multi var thing.
 
Top