Re: The strangest output

From: Date: Sat, 17 May 2003 21:41:18 +0000
Subject: Re: The strangest output
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148048@lists.php.net to get a copy of this message
$result_count is a MySQL result set resource. You need to use mysql_fetch_array() and friends on it. Ryan A wrote:
Hey guys, Still stuck on this after 4 hours...and cant understand why it isnt working. The output of this code is below but heres the code first: <?php require_once("configbwh.php"); error_reporting (E_ALL); $user= $_POST["user"]; $pass= $_POST["pass"]; if(isset($user) && $user && isset($pass) && $pass) { $connected=mysql_connect ("$hostt", "$userr", "$passs") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$db"); $query_count = "SELECT COUNT(*) FROM main_co where user='".$user."' and pass='".$pass."'"; $result_count = mysql_query($query_count); if($result_count==1) {
    session_start();
    header("Cache-control: private"); //IE 6 Fix
    $_SESSION['user'] = $user;
    $_SESSION['pass'] = $pass;
    print($result_count);
//     header("Location:co.details.php");
    error_reporting (E_ALL);
    exit;
} print("wrong"); } ?> when i execute that script i get the output: "wrong",
and if I put :    if($result_count==2)
instaed of : if($result_count==1) then I get this strange output: Resource id #2 What the heck is wrong with this code? -Ryan
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#148048) next »