Community
Showing results for 
Search instead for 
Do you mean 
Reply

Using ACT database with PHP

Accepted Solution Solved
Copper Contributor
Posts: 8
Country: USA
Accepted Solution

Using ACT database with PHP

Hi, i manage to connect to ACT database using an odbc connection with sql server driver.

However, whenever i try to execute a query, i get this error:

 

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Conversion failed when converting from a character string to uniqueidentifier., SQL state 37000 in SQLExecDirect in C:\wamp64\www\Act\act.php on line 40.

 

i use this code:

 

$dsn="Driver={ODBC Driver 11 for SQL Server};Server={178.xxx.x.xx,port};Database=TESTJR;";
$user="ACTREADER";
$mdp="Incisiv357";


$connection=odbc_connect($dsn, $user, $mdp);

if($connection==false)
print_r(odbc_error($connection));
else{
echo "Connection réussie";
try{
$requete="select contact from CONTACT";
odbc_exec($connection, $requete);


}
catch(exception $e){
print_r($e);
}
}

Is it possible that i'm using the wrong driver? although i've tried a couple.

Any help would be appreciated.

 

I'm using ACT Premium version 18 and i have ACTREADER set up properly.


Accepted Solutions
Solution
Accepted by topic author stashcb4
‎08-09-2016 03:55 AM
Copper Contributor
Posts: 8
Country: USA

Re: Using ACT database with PHP

Actually, i solved my problem.The table contact can't be accessed through odbc, i have to use TBL_CONTACT and is working just fine. The only problem is my customed fields don't have the same name as in act!

View solution in original post


All Replies
Nickel Contributor
Posts: 175
Country: USA

Re: Using ACT database with PHP

Based on the message you posted

 

Conversion failed when converting from a character string to uniqueidentifier

It looks to be more of a query issue than a driver issue. At the very least, proving out the query is a lot easier than the driver. Is the SQL query that you posted one that you've tried out? The query you posted shouldn't be doing anything with uniqueidentifier, so I would presume that the posted query isn't what you are actually trying. If it is, you shouldn't be getting a SQL error about converting character data to a uniqueidentifier.

 

 

Could you please post the actual SQL statement you are running or post the results of the statement you posted: "Select contact From CONTACT"?

Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: Using ACT database with PHP

Copper Contributor
Posts: 8
Country: USA

Re: Using ACT database with PHP

Thanks for your interest and quick replies. I agree with you that i shoundn't get this error since i'm not using the contactid column in my query.

But i can assure you that's the query that generate the error. Actually any query reproduce the same error. That's why i think it's maybe the driver version but at the same time the connection to the database works just fine.

 

should i use table like TBL_CONTACT for ODBC?

 

line 40 is Smiley Surpriseddbc_exec($connection, $requete);

Copper Contributor
Posts: 8
Country: USA

Re: Using ACT database with PHP

line 40 :   odbc_exec($connection, $requete);

Solution
Accepted by topic author stashcb4
‎08-09-2016 03:55 AM
Copper Contributor
Posts: 8
Country: USA

Re: Using ACT database with PHP

Actually, i solved my problem.The table contact can't be accessed through odbc, i have to use TBL_CONTACT and is working just fine. The only problem is my customed fields don't have the same name as in act!