SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Jun 8, 2004, 23:32 #1
- Join Date
- Mar 2004
- Location
- South Africa
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP UNIXODBC help, I'm stumped and confused
Hi guys, 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);
-
Jun 9, 2004, 05:13 #2
- Join Date
- May 2003
- Location
- Washington, DC
- Posts
- 10,653
- Mentioned
- 4 Post(s)
- Tagged
- 0 Thread(s)
What error are you getting?
Did you install the libraries it says it requires for the SQL server functions to work? Might also be needed for SQL server over odbc.
In addition, have you setup an ODBC DSN? Does it point to a specific database?
WWB
-
Jun 10, 2004, 00:02 #3
- Join Date
- Mar 2004
- Location
- South Africa
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by wwb_99
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 and that works fine
-
Jun 10, 2004, 05:41 #4
- Join Date
- May 2003
- Location
- Washington, DC
- Posts
- 10,653
- Mentioned
- 4 Post(s)
- Tagged
- 0 Thread(s)
Hmm. I think I saw something about this when looking at the PHP/ODBC bugs. You might want to post something there.
Another thing to try would be to create a stored proc, rather than passing raw SQL.
WWB
-
Jun 10, 2004, 06:05 #5
- Join Date
- Mar 2004
- Location
- South Africa
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
which forum is that specifically
Originally Posted by wwb_99
The one with PHP/ODBC bugs?
Bookmarks