• PHP Help PHP Coding
  • [RESOLVED] Warning: in_array() [function.in-array]: Wrong datatype for second argument in ...

I have a little query that wont do what i want 🙂
here is the code :

<?php
include 'conetcion.php';

$query = "SELECT Sub_Name FROM subject WHERE Prof_Id = $Prof_Id";

//execute the SQL query and return records
$result=mysql_query($query);

/$nRows = mysql_num_rows($result);
echo $nRows;
/

$row = mysql_fetch_assoc ($result);
echo "<TABLE border=1>\n";
echo "<TR>\n";

foreach ($row as $heading=>$column) {
echo "<TD><b>";
if (in_array ($heading, $allowed_order)) {
echo "<a href=\"{$_SERVER['PHP_SELF']}?order=$heading\">$heading</a>";
}
else {
echo $heading;
}
echo "</b></TD>\n";
}
echo "</TR>\n";

mysql_data_seek ($result, 0);
while ($row = mysql_fetch_assoc ($result)) {
echo "<TR>\n";
foreach ($row as $column) {
echo "<TD>$column</TD>\n";
}
echo "</TR>\n";
}
echo "</TABLE>\n";

mysql_free_result($result);

?>

when running it i get a "Warning: in_array() [function.in-array]" and after it the result in row's
someone knows shat is my problem 🙂??

    Write a Reply...