Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP/MySQL

Name: Anonymous 2009-09-09 12:15

Hi guys, I hope someone can help me out here.
I'm trying to count how many records there are in my "voc" table where the "kan" cell is not empty.

When I execute my code I get "Query was empty"

$sql = "SELECT COUNT(nl) FROM voc WHERE kan IS NOT NULL";
  $result = mysql_query($query) or die(mysql_error());

        while($obj = mysql_fetch_object($result)) {
        echo "<h1>" . $obj['COUNT(nl)'] ."</h1>";
        }

Name: OP 2009-09-09 12:36

Allright, someone on IRC helped me, I used $query but defined $sql
the problem is now that it doesn't seem to care about
WHERE kan IS NOT NULL
it's returning everything, including the ones that are empty

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List