php-db | 2001071

[PHP-DB] PHP-ODBC-MSSQL (Text type fields) PART II From: Michael Yevdokimov (michaely <email protected>)
Date: 07/10/01

Hi

I found an interesting thing.. But it will just make my work much harder..
comparing to ASP... :o(((( (which I already am not able to use in the
project we should deliver to our customer in a few weeks.... :o((((

<?php
// database settings
$dsn = "dsn_database";
$user = "enduser";
$pass = "";

$query = "EXEC usp_get_subj 10";

/*
$query = "SELECT col_subj_id,
                col_cat_id,
                col_lang_id,
                col_subj_class,
                col_subj_owner_id,
                col_subj_secur,
                col_subj_last_update,
                col_subj_title, --varchar(512)
                col_subj_reg_page, --varchar(128)
                col_subj_content, -- text(16)
                col_subj_keywords --varchar(256)

FROM tbl_subject WHERE col_subj_id = 10";
*/

$conn = odbc_connect($dsn, $user, $pass);
$res = odbc_exec($conn, $query);

$data = odbc_result($res, "col_subj_content");
$data = odbc_result($res, 8);

echo $data;
odbc_close($conn);
?>

This code will not retrieve the data from col_subj_content.. But!!
If I replace the call of the stored procedure by the same its content but as
an obviouse SQL query, everything will work and I will get the content of
this field.. Hmm... So, what is the hell is that??? Could anyone HELP me to
use the calls of sp way in the right way?!?

<?php
// database settings
$dsn = "dsn_database";
$user = "enduser";
$pass = "";

$query = "SELECT col_subj_id,
                col_cat_id,
                col_lang_id,
                col_subj_class,
                col_subj_owner_id,
                col_subj_secur,
                col_subj_last_update,
                col_subj_title, --varchar(512)
                col_subj_reg_page, --varchar(128)
                col_subj_content, -- text(16)
                col_subj_keywords --varchar(2560

FROM tbl_subject WHERE col_subj_id = 10";

$conn = odbc_connect($dsn, $user, $pass);
$res = odbc_exec($conn, $query);

$data = odbc_result($res, "col_subj_content");
$data = odbc_result($res, 8);

echo $data;
odbc_close($conn);
?>

The stored procedure is:

Create Procedure usp_get_subj
        (
                 <email protected> int
        )
As

SELECT col_subj_id,
                col_cat_id,
                col_lang_id,
                col_subj_class,
                col_subj_owner_id,
                col_subj_secur,
                col_subj_last_update,
                col_subj_title, --varchar(512)
                col_subj_reg_page, --varchar(128)
                col_subj_content, -- text(16)
                col_subj_keywords --varchar(2560

FROM tbl_subject WHERE col_subj_id =  <email protected>
RETURN

Michael Yevdokimov
Web developer
e-mail: michaely <email protected>

--------------------------------
Globalocity B.V.
Tel.: +31 (0)70 312 2814
Fax.: +31 (0)70 312 2808
http://www.globalocity.com
e-mail: info <email protected>
--------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>