Jump to content


Photo

Array Help


  • Please log in to reply
1 reply to this topic

#1 Petsmacker

Petsmacker
  • Members
  • PipPipPip
  • Advanced Member
  • 71 posts

Posted 19 March 2006 - 12:57 PM

<?
$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>

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

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

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

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 March 2006 - 03:58 PM

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

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users