PHP guru's

Soldato
Joined
4 Nov 2006
Posts
2,752
Location
Yorkshire
Can anyone tell me why the snippet below is causing this error:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, object given in C:\wamp\www\departments.php on line 92

Code:
<?php
$con=mysqli_connect("localhost","xxxxx","xxxxx","xxxxx");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

echo "<table style='width: 91%'>
				<tr>
					<td class='auto-style3' style='width: 225px'>
					<img height='20' src='img/departments.jpg' width='150'></td>
					<td style='width: 253px'></td>
					<td style='width: 316px'></td>
					<td style='width: 130px'></td>
				</tr>";

$result = mysqli_query($con,"SELECT DISTINCT dept FROM tel_dir_tbl");
$row = 0;
$column = 0;
echo "<table>";
while($row = mysql_fetch_assoc($result)) {
    if ($column == 0) {echo "<tr>";}
    if (($column == 2) && ($row == 0)){echo "<td>content</td></tr><tr>";}
  echo "<td>".$row['dept']."</td>";
  $column++;
  if ($column >= 3) {
    $row++;
    echo "</tr>";
    $column = 0;
  }
}
echo "</table>";
mysqli_close($con);
?>

Line 92 being specific to:

Code:
while($row = mysql_fetch_assoc($result)) {
 
Back
Top Bottom