i have an issue make this code work ..
<?php

If (!$db) {
function dbquery($strSQL) {
global $db;
If (!$queryValue = @($strSQL, $db)) {
die("<p><font color='red'>Error: ".mysql_error());
} Else {
return $queryValue;
}
}

function dbqueryWithAlert($strSQL, $adminEmail, $errorMessage) {
global $db, $strError, $criticalTransactionError;
If (!$queryValue = @($strSQL, $db)) {
mail($adminEmail, "PMI Critical Error: ".date("m-d-Y"), $errorMessage);
$strError = $errorMessage;
$criticalTransactionError = TRUE;
} Else {
return $queryValue;
}
}

$db = mysql_connect('localhost','dbuser','dbpass');
mysql_select_db('dbname',$db);
}

?>

it will give me this page..
Notice: Undefined variable: db in c:\inetpub\wwwroot\misassets\Includes\db.inc.php on line 3

Notice: Undefined variable: hardwareID in c:\inetpub\wwwroot\misassets\Includes\global.inc.php on line 25

Notice: Undefined variable: peripheralID in c:\inetpub\wwwroot\misassets\Includes\global.inc.php on line 25

Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\misassets\Includes\db.inc.php:3) in c:\inetpub\wwwroot\misassets\Includes\generalFunctions.inc.php on line 194

Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\misassets\Includes\db.inc.php:3) in c:\inetpub\wwwroot\misassets\Includes\generalFunctions.inc.php on line 195

any ideas I am already turn on the global_variable on php.ini...
by the way I am a Beginner...

    The "Notice: Undefined variable:...." messages are just php telling you, you are using a undefined var. But php works fine with that so you can ignore those, or define them before use.

    The "Warning: Cannot modify header information..." messages comes when you send some header information AFTER writing some output ex. print("Hello world!");

    wrong way:

      print("Hello world");
      header("HTTP/1.0 404 Not Found");
    

    right way:

     header("HTTP/1.0 404 Not Found");
      print("Hello world");
    

    So you can either make sure that you output all headers before writting something or use the output control functions control your output. look at http://www.php.net/manual/en/ref.outcontrol.php for more info.

      Write a Reply...