Jump to content

somethings wrong with the mysql_num_rows(


OranniS

Recommended Posts

hi
i was making a start page, where one must register a personal code, as in password, to proceed to the main site.

to check if the code has already been used by someone else, i used the mysql_num_rows() function, but somethings making it fail...

this is where i define a function wich is causing the whole jam. ive tried echoeing here and there, turns out the line with the error is the one with the
$count = mysql_num_rows($result) or die(mysql_error());...


[code]PHP Code:
<?php
    session_start();
    require_once('vars.php');
   
    //connectie maken met DB
            $db = mysql_connect("localhost", "dieetopmaat_be", "dieetDB") or die(mysql_error());
            mysql_select_db(dieetopmaat_be, $db) or die(mysql_error());
   
    function check_presence($table, $row, $value){
   
        $sql = "SELECT *    FROM $table
                            WHERE $row = '$value'";
        $result = mysql_query($sql) or die(mysql_error());

        $count = mysql_num_rows($result) or die(mysql_error());

    if($count >= 1)
        {
        return TRUE;
    }else
        {
        return FALSE;
    }[/code]


thanks to anyone who replies!
OranniS

ps: dont mind the language, its written in dutch
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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