Jump to content

Wrong parameter count for in_array() ?


Mr Chris

Recommended Posts

Hi All,

 

I have a query for getting some values for a column out of a mysql database.  Basically if the value is 1 'Yes' is ticked and if the value is 0 'No' is ticked. Apart from making the values checked or not checked.

 

Now this works fine:

 

<?php
$subsections	= mysql_query("SELECT * FROM file WHERE websheet = 0");
while ($subsection = mysql_fetch_array($subsections)) {
echo '
        <span> '.$subsection['description'].'<br />
	<label for="'.$subsection['description'].'">
        <input type="radio" class="checkbox" name="subsection['.$int.']" value="1"'; if (in_array($subsection['section_id'] == 1)) { echo ' checked="checked"'; } echo ' /> Yes	
        <input type="radio" class="checkbox" name="subsection['.$int.']" value="1"'; if (in_array($subsection['section_id'] == 0)) { echo ' checked="checked"'; } echo ' /> No
	</label></span>			
 ';
	if ($ml10 == 4) { $ml10 = 1; } else { $ml10++; }
	$int++;
	} // end while subsectionRows
echo '</fieldset></div>';
//} // end while sectionRows
 ?>

 

Now the Only problem with this is these part

 

if (in_array($subsection['section_id'] == 1)) { echo ' checked="checked"'; } echo ' /> Yes
if (in_array($subsection['section_id'] == 0)) { echo ' checked="checked"'; } echo ' /> No

 

Basically depending if it's a Yes or no I want the checkbox to be checked, but I get this error:

 

Warning: Wrong parameter count for in_array() in /home/********/public_html/cms-testing/admin/options/edit.php on line 146

 

Can anyone kindly help?

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/183105-wrong-parameter-count-for-in_array/
Share on other sites

Archived

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

×
×
  • 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.