Re: The strangest output
| From: | Timothy Hitchens | Date: | Sat, 17 May 2003 21:41:03 +0000 |
| Subject: | Re: The strangest output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148047@lists.php.net to get a copy of this message | ||
Ryan,
You can start by outputting with echo $query_count to ensure that you
SQL is correct.
What error level do you have turned on??
Timothy Hitchens (HiTCHO)
Web Application Consulting
e-mail: tim@hitcho.com.au
Sunday, May 18, 2003, 7:33:44 AM, you wrote:
RA> Hey guys,
RA> Still stuck on this after 4 hours...and cant understand why it isnt working.
RA> The output of this code is below but heres the code first:
RA> <?php
RA> require_once("configbwh.php");
RA> error_reporting (E_ALL);
RA> $user= $_POST["user"];
RA> $pass= $_POST["pass"];
RA> if(isset($user) && $user && isset($pass) && $pass)
RA> {
RA> $connected=mysql_connect ("$hostt", "$userr", "$passs") or die
RA> ('I cannot
RA> connect to the database because: ' . mysql_error());
RA> mysql_select_db ("$db");
RA> $query_count = "SELECT COUNT(*) FROM main_co where user='".$user."'
RA> and
RA> pass='".$pass."'";
RA> $result_count = mysql_query($query_count);
RA> if($result_count==1)
RA> {
RA> session_start();
RA> header("Cache-control: private"); //IE 6 Fix
RA> $_SESSION['user'] = $user;
RA> $_SESSION['pass'] = $pass;
RA> print($result_count);
RA> // header("Location:co.details.php");
RA> error_reporting (E_ALL);
RA> exit;
RA> }
RA> print("wrong");
RA> }
RA> ?>
RA> when i execute that script i get the output: "wrong",
RA> and if I put : if($result_count==2)
RA> instaed of : if($result_count==1)
RA> then I get this strange output: Resource id #2
RA> What the heck is wrong with this code?
RA> -Ryan