Jump to content

Array Help


Petsmacker

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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.