I have a file named connectDB.inc.php:
Code: Select all
<?php
define("DB_SERVER", "localhost");
define("DB_USER", "");
define("DB_PASSWORD", "");
define("DSN", "records");
//Establish database connection
$DB_CONN = odbc_connect(DSN, DB_SERVER, DB_USER, DB_PASSWORD) or die ("Could not connect to server...");
?>when I try to run the query on $DB_CONN, I receive "unexpected T_GLOBAL" errors.
How am I supposed to use $DB_CONN here??
Code: Select all
<?php
require "connectDB.inc.php";
require 'databaseFunctions.inc.php';
function authenticate($emailAddr, $password){
$salt = substr($password, 0, 2);
$encryptedPassword = crypt($password, $salt);
$query = "SELECT name FROM member WHERE email = '$emailAddr' AND password = '$encryptedPassword'";
$rs = executeQuery(global $DB_CONN, $query);databaseFunctions.inc.php:
Code: Select all
//a sample function in the file
<?php
function executeQuery($DB_CONN, $query){
$queryRs = odbc_exec($DB_CONN, $query) or die ("Unable to execute query for the MEMBER table...");
return $queryRs;
}
?>