Problem with Array...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Problem with Array...

Post 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]
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

try putting the math in parentheses ($a[$n] * $b[$n]);
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Post by kevin7 »

it dun work... :(
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

what's in $a and $b ?
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Post by kevin7 »

$a and $b are array...

help me~... is urgent~ :(
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Whick line exactly is 548
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

i know they're arrays - but what are they full of?
User avatar
Lord Sauron
Forum Commoner
Posts: 85
Joined: Tue Apr 20, 2004 5:53 am
Location: Tilburg, NL

Try print_r

Post by Lord Sauron »

What are the results of the following commands?

print_r($a[$n]);
print_r($b[$n]);
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Post 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:
Post Reply