Har fått lite problem med sessioner, får meddelandet:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxxx/xxxxxx.yy/admin/login.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at /home/d11214/vadkostardet.nu/admin/login.php:11) in /home/xxxx/xxxxxx.yy/admin/login.php on line 23
koden i logon.php är:
<?php
session_start ();
require "../lib/library.lib";
// Data base connection structure
$connectionid = OpenDatabaseConnection();
$sql = "SELECT ". "UserID, UserName, Surname, GivenName ". "FROM ". "Users ". "WHERE ". "(UserName like '".$_REQUEST["name"]."') AND ". "(Password = '".md5 ($_REQUEST["pwd"])."')";
$result = mysql_query ($sql);
if (mysql_num_rows ($result) > 0) {
// Pick out user data in an array.
$data = mysql_fetch_array ($result);
// Create and register session variables
$_SESSION["user_id"] = $data["UserID"];
$_SESSION["user_nickname"] = $data["UserName"];
$_SESSION["user_nachname"] = $data["Surname"];
$_SESSION["user_vorname"] = $data["GivenName"];
header ("Location: intern.php");
} else {
header ("Location: index.php?error=1");
}
?>
Vet någon vad problemet är?