Page 1 of 1

Problem with Array...

Posted: Wed May 26, 2004 6:28 am
by kevin7
Warning: Cannot use a scalar value as an array in c:\inetpub\wwwroot\mc\sales_form.php on line 548

what does this means?

part of my code that generate this error was...

Code: Select all

$s=2

for ($n=1; $n<=$s; $n++) &#123;

$result&#1111;$n] = $a&#1111;$n] * $b&#1111;$n];

&#125;
is that we cannot use array for mathematic calculation?[/b]

Posted: Wed May 26, 2004 7:17 am
by magicrobotmonkey
try putting the math in parentheses ($a[$n] * $b[$n]);

Posted: Wed May 26, 2004 7:29 am
by kevin7
it dun work... :(

Posted: Wed May 26, 2004 7:40 am
by magicrobotmonkey
what's in $a and $b ?

Posted: Wed May 26, 2004 8:23 am
by kevin7
$a and $b are array...

help me~... is urgent~ :(

Posted: Wed May 26, 2004 8:26 am
by JayBird
Whick line exactly is 548

Posted: Wed May 26, 2004 8:31 am
by magicrobotmonkey
i know they're arrays - but what are they full of?

Try print_r

Posted: Wed May 26, 2004 9:36 am
by Lord Sauron
What are the results of the following commands?

print_r($a[$n]);
print_r($b[$n]);

Posted: Wed May 26, 2004 9:49 am
by kevin7
oo.. thx all dude... :D
i already solve it in other way... :wink:

anyway, thx ya help... this forum was great! fast response...!!! :twisted: :twisted: :twisted: