-6

here is my code , I could not find where's the problem!

<?php

include("dbc.php");
$result = mysqli_query($dbc,"SELECT * FROM employee");

while($row = mysqli_fetch_array($result))
{
    echo $row['name'] . " " . $row['age']." ".$row['id'];
    echo "<br>";
}
?>
Sal00m
  • 2,938
  • 3
  • 22
  • 33
Yazour
  • 11
  • 1
  • 1
  • 1

1 Answers1

0

mysqli_query "Returns FALSE on failure."

Please double check whether $dbc is really created and of expected type.

See: http://www.php.net/mysqli_query

feeela
  • 29,399
  • 7
  • 59
  • 71
  • 4
    How is this any different from asking, what we have asked in the comment ? – samayo Oct 24 '13 at 08:49
  • It is the most probable source of that error and I didn't saw any comments before posting this answer… – feeela Oct 24 '13 at 08:50
  • 1
    Please fasten your seatbelts and read the safety-manual of the internet before you start using your internet browser. Thank you :) - It is the most probably source of making many unrequired words for a very short time-span of OPs attraction falling into dust after the a-ha moment the OP will become not finding the search box. – hakre Oct 24 '13 at 08:55
  • ok ok so how can I improve my code? – Yazour Oct 24 '13 at 09:34
  • notice that the connection code is true >> I checked that before. – Yazour Oct 24 '13 at 09:39
  • @Yazour: This is a reference Q&A on your issue: [mysql_fetch_array() expects parameter 1 to be resource, boolean given in select](http://stackoverflow.com/q/2973202/367456) (the issue you have is a common beginners mistake (don't worry), all you need is to understand what happens here. Once you've understood that, you have learned something very useful in programming, and that is looking for failure conditions. But you best learn that by confronting yourself with the issue, just checkout the link) – hakre Oct 24 '13 at 09:44