[CODE=php]// Relevant parts of my DB class (from include file)
class db_connection
{
function __construct()
{
$this->con = odbc_connect('S hippingData','n ame','pass');
}
private $con;
function Prepare($query)
{
return odbc_prepare($t his->con, $query);
}
// Execute prepared queries...
function Pexec($pq, $arr)
{
return odbc_exec($pq, $arr); // This is line 43 from below error
}
}
// *** clip from my file ***
$db = new db_connection;
// Build the query...
$query = "INSERT INTO Customers (CustomerID,Com panyName,Contac tName) VALUES (?,?,?);";
// Prepare the query
$pquery = $db->Prepare($query );
// Build data array...
$arr = array($customer _id,$company_na me,$contact_nam e);
// Execute the prepared query... (dies in this func)
$db->Pexec($pquer y, $arr); [/CODE]
// The error I get
Warning: odbc_exec(): supplied resource is not a valid ODBC-Link resource in E:\Web\ShipView \inc\db.phpinc on line 43
What is causing me to get this error? I'm doing what every other example I've ever seen online is doing. Please help.
class db_connection
{
function __construct()
{
$this->con = odbc_connect('S hippingData','n ame','pass');
}
private $con;
function Prepare($query)
{
return odbc_prepare($t his->con, $query);
}
// Execute prepared queries...
function Pexec($pq, $arr)
{
return odbc_exec($pq, $arr); // This is line 43 from below error
}
}
// *** clip from my file ***
$db = new db_connection;
// Build the query...
$query = "INSERT INTO Customers (CustomerID,Com panyName,Contac tName) VALUES (?,?,?);";
// Prepare the query
$pquery = $db->Prepare($query );
// Build data array...
$arr = array($customer _id,$company_na me,$contact_nam e);
// Execute the prepared query... (dies in this func)
$db->Pexec($pquer y, $arr); [/CODE]
// The error I get
Warning: odbc_exec(): supplied resource is not a valid ODBC-Link resource in E:\Web\ShipView \inc\db.phpinc on line 43
What is causing me to get this error? I'm doing what every other example I've ever seen online is doing. Please help.
Comment