Forum Moderators: coopster

Message Too Old, No Replies

why do i get errors with one server but not another

         

supermanjnk

7:53 am on Jul 23, 2004 (gmt 0)

10+ Year Member



I have my local server, which i do for building, before i upload to a host, I have php 4 and i think mysql is 4 aswell Why is it that when I upload these to my payed for domain i don't get the errors, when i have them on my machine i do.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php:12) in E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php:12) in E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php on line 15

this is the code i have right now (it's not completed yet) and lines 14 and 15, are the cookie and headers

<? include ("../admin/config.php");
//checks to see if cookie is set
if (!isset ($_COOKIE["dhananscookie"]))
{
mysql_connect($host ,$user,$pass) or die("Unable to connect to database");
mysql_select_db("$db") or die("Unable to select database $db");
// Formulate the query
$sql = "SELECT * FROM $utable WHERE username='" . $username . "' AND user_password = '" . md5($password) . "' AND user_active = '" . 1 . "'";
// Execute the query and put results in $result
$result = mysql_query($sql);
// Get number of rows in $result. 0 if invalid, 1 if valid.
$num = mysql_num_rows($result);
if ($num!= "0") {
setcookie("testcookie", $username, time()+86400);
header ("../logout_form.php");
exit;
}
}
?>

coopster

12:53 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It is the level of error_reporting [php.net] in the PHP configuration. Also, have a look at display_errors [php.net].

There are some tips in the PHP Troubleshooting [webmasterworld.com] thread showing how you can use this directive.

timster

1:24 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One other tip: while you are developing the site, you may want to report errors from mysql_query and/or mysql_connect, like so:

if (! $result = mysql_query($sql) ) or die ("Query failed: " . mysql_error());