OK this one may be a bit long but here goes
I'm using UNIXODBC to communicate with a MSSQL Server. I've got this crazy query that works in a direct SQL connection tool but in the PHP webpage it doesnt work. Could somebody help me out, I'll paste the code below.
THE STRAIGHT SQL version vuia connection tool
select DISTINCT
Itm_Itemnr,Itm_ISBNNr,Itm_Outeur,Itm_AfrikaPrys,
Itm_DollarPrys,Itm_PondPrys,Itm_EuroPrys,
Itm_WebStatus,Itm_SellOnWeb ,
Bb_Itemnr,Bb_Translated,Bb_Language,Bb_Title,Bb_SubTitle,
CONVERT (VARCHAR(1500),Bb_KortBeskrywing) AS Short,
Img_Itemnr,Img_Image,
IKat_Itemnr, IKat_Kategorie,Itm_Prys
from Items
INNER JOIN BoekBeskrywing ON Itm_Itemnr = Bb_Itemnr
INNER JOIN Image ON Itm_Itemnr = Img_Itemnr
INNER JOIN ItemKategorie ON Itm_Itemnr = Kat_Itemnr
WHERE Itm_SellOnWeb =1 AND IKat_Kategorie ='Art';
=============================================
here's ther web version
$sqlconnect=odbc_connect($dsn, $SQLUser,$SQLPass);
$odbcsql="select DISTINCT Itm_Itemnr,Itm_ISBNNr,Itm_Outeur,Itm_AfrikaPrys,
Itm_DollarPrys,Itm_PondPrys,Itm_EuroPrys,
Itm_WebStatus,Itm_SellOnWeb ,
Bb_Itemnr,Bb_Translated,Bb_Language,Bb_Title,Bb_SubTitle,
CONVERT (VARCHAR(1500),Bb_KortBeskrywing) AS Short,
Img_Itemnr,Img_Image,
IKat_Itemnr, IKat_Kategorie,Itm_Prys
from Items
INNER JOIN BoekBeskrywing ON Itm_Itemnr = Bb_Itemnr
INNER JOIN Image ON Itm_Itemnr = Img_Itemnr
INNER JOIN ItemKategorie ON Itm_Itemnr = IKat_Itemnr
WHERE Itm_SellOnWeb =1 AND IKat_Kategorie ='Art';";
$process=odbc_exec($sqlconnect,$odbcsql);
===============
And thats the funny thing. just no rows returned. In fact I tried to run with IKat_Kategorie LIKE 'Music' or IKat_Kategorie = 'Music' and still no rows
I've setup the right drivers and DSN, it will return rows as long as I dont try and match against any text.
For example I could go "where webitem =1 AND price >$40"
that works fine
Andrew Adar
UNISA Press
Web Dev