fout in de mysql_num_rows();

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Stephan Sterrenberg

Stephan Sterrenberg

19/07/2007 07:15:00
Quote Anchor link
hey allemaal
ik krijg elke keer de deze fout te zien
weet iemand een oplossing hiervoor
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/index.php on line 22

script is
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?
error_reporting(E_ALL);
session_start();

include("config.php");
include("functions.php");

if(!isset($_COOKIE['last_active']))
{

    if(isset($_SESSION['user_id']))
    {

        mysql_query("UPDATE tbl_users SET user_lastactive = NOW() WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());
        setcookie("last_active",true,time()+5);
    }
}


if(!isset($_SESSION['user_id']))
{

    if(isset($_POST['login']))
    {

        $query = mysql_query("SELECT * FROM tbl_users WHERE user_name = '" . $_POST['user'] . "' AND user_pass = '" . md5($_POST['pass']) . "'");
        $result = mysql_num_rows($query);

        if(empty($result))
        {

            echo "<script>alert('Login Incorrect.'); document.location.href=('index.php')</script>";
        }

        else
        {
            while($row = mysql_fetch_assoc($query))
            {

                $user_id = $row['user_id'];
            }


            header("Location: index.php");
            $_SESSION['user_id'] = $user_id;
        }
    }

    else
    {
?>

<h1>Log In</h1>
<form method="POST">
<input type="hidden" value="1" name="login">
Username : <input type="text" name="user" maxlength="15"><br>
Password : <input type="password" name="pass" maxlength="15"><br><br>

<input type="Submit" value="Login"><br><br>
<img src="icons/register.gif"> <a href="register.php">Register</a><br>
<img src="icons/memberlist.gif"> <a href="memberlist.php">Memberlist</a>

<?
    }
}

else
{
    $query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");

    while($row = mysql_fetch_assoc($query))
    {

        echo "Username : <b>" . $row['user_name']. "</b>";

        if($row['user_pm'])
        {

            $msg = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'"),0);

            if(empty($msg))
            {

                $msg = "<font color=\"#008000\">Empty</font>";
            }

            elseif($msg >= $cfg['max_msg'])
            {

                $msg = "<font color=\"#FF0000\">FULL</font>";
            }

            else
            {
                $msg = $msg . " / " . $cfg['max_msg'];
            }


            echo "<br>\n";
            echo "Inbox : <b>". $msg ."</b> ( <a href=\"msg.php?act=inbox\">Open</a> )";
        }
    }


    echo "<br>\n<br>\n";

    if(isset($_SESSION['admin_login']))
    {

        
        echo "<img src=\"icons/admin.gif\"> <a href=\"admin.php\">Admin Page</a>";
        echo "<br>\n";
    }


    echo "<img src=\"icons/memberlist.gif\"> <a href=\"memberlist.php\">Memberlist</a>";
    echo "<br>\n";
    echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=edit_profile\">Change Profile</a>";
    echo "<br>\n";
    echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">My Profile</a>";
    echo "<br>\n";
    echo "<img src=\"icons/logoff.gif\"> <a href=\"logoff.php\">Log Off</a>";
}

?>


groertjes wesley
 
PHP hulp

PHP hulp

25/11/2024 01:39:50
 
Jan Koehoorn

Jan Koehoorn

19/07/2007 07:24:00
Quote Anchor link
Je doet dan ook geen enkele controle! Verander
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
    $query
= mysql_query("SELECT * FROM tbl_users WHERE user_name = '" . $_POST['user'] . "' AND user_pass = '" . md5($_POST['pass']) . "'");
?>

eens in
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
    $sql
= "
        SELECT *
        FROM tbl_users
        WHERE
            user_name = '"
. $_POST['user'] . "'
        AND
            user_pass = '"
. md5($_POST['pass']) . "'";
    if (!$res = mysql_query ($sql)) {
        echo '<pre>';
        trigger_error (mysql_error ());
        echo htmlentities (str_replace ("\t", '', $sql));
        echo '</pre>';
    }

    else {
    // hier gaan fetchen
    }
?>
 
Stephan Sterrenberg

Stephan Sterrenberg

19/07/2007 07:27:00
Quote Anchor link
krijg dit terug
Notice: Undefined index: cfg_wlcmtitle in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/config.php on line 34

Notice: Undefined index: cfg_wlcmmsg in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/config.php on line 35

Notice: Undefined index: cfg_wlcmtitle in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/config.php on line 34

Notice: Undefined index: cfg_wlcmmsg in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/config.php on line 35


Notice: Table 'memberlogin.tbl_users' doesn't exist in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/index.php on line 30

SELECT *
FROM tbl_users
WHERE
user_name = 'admin'
AND
user_pass = '81dc9bdb52d04dc20036dbd8313ed055'

Notice: Undefined variable: query in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/index.php on line 38

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/index.php on line 38
 
Jan Koehoorn

Jan Koehoorn

19/07/2007 07:30:00
Quote Anchor link
Die hele tabel tbl_users bestaat niet in je database. Vandaar dat je query mislukt.
 
Stephan Sterrenberg

Stephan Sterrenberg

19/07/2007 07:31:00
Quote Anchor link
die bestaat wel
of ik doe het fout in het script

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?
error_reporting(E_ALL);
session_start();

include("config.php");
include("functions.php");

if(!isset($_COOKIE['last_active']))
{

    if(isset($_SESSION['user_id']))
    {

        mysql_query("UPDATE tbl_users SET user_lastactive = NOW() WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());
        setcookie("last_active",true,time()+5);
    }
}


if(!isset($_SESSION['user_id']))
{

    if(isset($_POST['login']))
    {

        $sql = "
        SELECT *
        FROM tbl_users
        WHERE
            user_name = '"
. $_POST['user'] . "'
        AND
            user_pass = '"
. md5($_POST['pass']) . "'";
    if (!$res = mysql_query ($sql)) {
        echo '<pre>';
        trigger_error (mysql_error ());
        echo htmlentities (str_replace ("\t", '', $sql));
        echo '</pre>';
    }

    else {
    // hier gaan fetchen
    }

        $result = mysql_num_rows($query);

        if(empty($result))
        {

            echo "<script>alert('Login Incorrect.'); document.location.href=('index.php')</script>";
        }

        else
        {
            while($row = mysql_fetch_assoc($query))
            {

                $user_id = $row['user_id'];
            }


            header("Location: index.php");
            $_SESSION['user_id'] = $user_id;
        }
    }

    else
    {
?>

<h1>Log In</h1>
<form method="POST">
<input type="hidden" value="1" name="login">
Username : <input type="text" name="user" maxlength="15"><br>
Password : <input type="password" name="pass" maxlength="15"><br><br>

<input type="Submit" value="Login"><br><br>
<img src="icons/register.gif"> <a href="register.php">Register</a><br>
<img src="icons/memberlist.gif"> <a href="memberlist.php">Memberlist</a>

<?
    }
}

else
{
    $query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");

    while($row = mysql_fetch_assoc($query))
    {

        echo "Username : <b>" . $row['user_name']. "</b>";

        if($row['user_pm'])
        {

            $msg = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'"),0);

            if(empty($msg))
            {

                $msg = "<font color=\"#008000\">Empty</font>";
            }

            elseif($msg >= $cfg['max_msg'])
            {

                $msg = "<font color=\"#FF0000\">FULL</font>";
            }

            else
            {
                $msg = $msg . " / " . $cfg['max_msg'];
            }


            echo "<br>\n";
            echo "Inbox : <b>". $msg ."</b> ( <a href=\"msg.php?act=inbox\">Open</a> )";
        }
    }


    echo "<br>\n<br>\n";

    if(isset($_SESSION['admin_login']))
    {

        
        echo "<img src=\"icons/admin.gif\"> <a href=\"admin.php\">Admin Page</a>";
        echo "<br>\n";
    }


    echo "<img src=\"icons/memberlist.gif\"> <a href=\"memberlist.php\">Memberlist</a>";
    echo "<br>\n";
    echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=edit_profile\">Change Profile</a>";
    echo "<br>\n";
    echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">My Profile</a>";
    echo "<br>\n";
    echo "<img src=\"icons/logoff.gif\"> <a href=\"logoff.php\">Log Off</a>";
}

?>
Gewijzigd op 01/01/1970 01:00:00 door Stephan Sterrenberg
 
Stephan Sterrenberg

Stephan Sterrenberg

19/07/2007 07:40:00
Quote Anchor link
heb nu het script aangepast
het is nu zo
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?
error_reporting(E_ALL);
session_start();

include("config.php");
include("functions.php");

if(!isset($_COOKIE['last_active']))
{

    if(isset($_SESSION['user_id']))
    {

        mysql_query("UPDATE tbl_users SET user_lastactive = NOW() WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());
        setcookie("last_active",true,time()+5);
    }
}


if(!isset($_SESSION['user_id']))
{

    if(isset($_POST['login']))
    {

        $sql = "
        SELECT *
        FROM tbl_users
        WHERE
            user_name = '"
. $_POST['user'] . "'
        AND
            user_pass = '"
. md5($_POST['pass']) . "'";
    if (!$res = mysql_query ($sql)) {
        echo '<pre>';
        trigger_error (mysql_error ());
        echo htmlentities (str_replace ("\t", '', $sql));
        echo '</pre>';
    }

    else {

        {

            while($row = mysql_fetch_assoc($query))
            {

                $user_id = $row['user_id'];
            }


            header("Location: index.php");
            $_SESSION['user_id'] = $user_id;
        }
    }

    else
    {
?>

<h1>Log In</h1>
<form method="POST">
<input type="hidden" value="1" name="login">
Username : <input type="text" name="user" maxlength="15"><br>
Password : <input type="password" name="pass" maxlength="15"><br><br>

<input type="Submit" value="Login"><br><br>
<img src="icons/register.gif"> <a href="register.php">Register</a><br>
<img src="icons/memberlist.gif"> <a href="memberlist.php">Memberlist</a>

<?
    }
}

else
{
    $query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");

    while($row = mysql_fetch_assoc($query))
    {

        echo "Username : <b>" . $row['user_name']. "</b>";

        if($row['user_pm'])
        {

            $msg = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'"),0);

            if(empty($msg))
            {

                $msg = "<font color=\"#008000\">Empty</font>";
            }

            elseif($msg >= $cfg['max_msg'])
            {

                $msg = "<font color=\"#FF0000\">FULL</font>";
            }

            else
            {
                $msg = $msg . " / " . $cfg['max_msg'];
            }


            echo "<br>\n";
            echo "Inbox : <b>". $msg ."</b> ( <a href=\"msg.php?act=inbox\">Open</a> )";
        }
    }


    echo "<br>\n<br>\n";

    if(isset($_SESSION['admin_login']))
    {

        
        echo "<img src=\"icons/admin.gif\"> <a href=\"admin.php\">Admin Page</a>";
        echo "<br>\n";
    }


    echo "<img src=\"icons/memberlist.gif\"> <a href=\"memberlist.php\">Memberlist</a>";
    echo "<br>\n";
    echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=edit_profile\">Change Profile</a>";
    echo "<br>\n";
    echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">My Profile</a>";
    echo "<br>\n";
    echo "<img src=\"icons/logoff.gif\"> <a href=\"logoff.php\">Log Off</a>";
}

?>

en krijg de volgende fout

Parse error: syntax error, unexpected T_ELSE in /storage/mijndomein/users/058605/public/sites/login.chat2you.eu/index.php on line 46
 
Stephan Sterrenberg

Stephan Sterrenberg

19/07/2007 07:51:00
Quote Anchor link
hij werkt nu
bedankt voor je hulp
 
- SanThe -

- SanThe -

19/07/2007 08:50:00
Quote Anchor link
@Wesley: * Bumpen * is pas na 24 uur toegestaan. Lees de regels (FAQ).
 
Stephan Sterrenberg

Stephan Sterrenberg

19/07/2007 08:52:00
Quote Anchor link
waar slaat dat berichtje nu weer op
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.