Jump to content

Archived

This topic is now archived and is closed to further replies.

Petsmacker

Array Help

Recommended Posts

[code] <?
$box1=mysql_result($b,0,"box1");
$box2=mysql_result($b,0,"box2");
$os = compact('box1', 'box2')?>

<table width=60%><tr><td bgcolor=#00FFFF><center><b><? if (in_array("0.01", $os)){echo "0.01 Galleons";}?></b></center></td><td><center><img src="images/dond/divide.gif"></center></td>[/code]

This is a very simplified version of the code but basically it keeps showing me:

[b]Warning: in_array(): Wrong datatype for second argument in /home/xxx/public_html/dond.php on line 21[/b] in the in_array() function. Can anybody help?

And YES, the mysql_result IS picking up the database data correctly.

Share this post


Link to post
Share on other sites
What do you expect to be returned by the line
[code]<?php $os = compact('box1', 'box2')?>[/code]
Put the code [code]<?php echo '<pre>' . print_r($os,true) . '</pre>'; ?>[/code] right after it and see if you're getting what you expect.

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.