Bug #11974 Updated: Pb with odbc_columns(); the 12th result(description)has a incorrect format

From: Date: Mon, 24 Jun 2002 21:39:00 +0000
Subject: Bug #11974 Updated: Pb with odbc_columns(); the 12th result(description)has a incorrect format
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11978@lists.php.net to get a copy of this message
ID: 11974 Updated by: kalowsky@php.net Reported By: moditii@yahoo.fr -Status: Open +Status: Feedback Bug Type: ODBC related Operating System: Windows 98 PHP Version: 4.0.6 New Comment: can you please give a sample schema to use as well? Also you may wish to try a newer version of PHP as there have been some changes in the codebase. Previous Comments: ------------------------------------------------------------------------ [2001-07-09 08:00:08] moditii@yahoo.fr The problem is that after these 2 lines: $resCol=odbc_columns($odbc_connect); $des=odbc_result($resCol,12); the print function works(the same for echo), and show the description as asked, but when I have to use it in an SQLreq., I have an error: #### Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression ''(ex: media).'., SQL state 37000 in SQLExecDirect in C:\Inetpub\wwwroot\cgi-bin\database\configok.php on line 95 #### As you can see I use an Access Database(2000) I tried to cut the string in logical way or static way but I don't find one working for all. However, often, if I cut the last 30 c. with $des=substr ($des, 0,strlen($des)-30);, it works for several fields, but not all...I tried to cut 3, to keep all until "." that I had added to all my fields. So here is a part of my code:(it's to make a table containing all fields with their description all fields have a different name) and I can say that there is not any problem with para 3(name of table),4(name of field): $resCol=odbc_columns($odbc_connect); $tablen=odbc_result($resTable,3); while(odbc_fetch_row($resCol)) { if (odbc_result($resCol,3)==$tablen)//if the table of the column { //is the table called $i++ ; $col=odbc_result($resCol,4); //set col to the name of the field //############################description doesn't work################### $des=odbc_result($resCol,12); //echo "<br>"; //print strlen($des); // echo "<br>"; // $des=substr ($des, 0,strrpos ($des, ".")-1); $des=substr ($des, 0,strlen($des)-30); // print strlen($des); echo "<br>"; if (empty($des)) { $des="a definir"; } echo "description: $des" ; //####################################################################### if (!empty($HTTP_POST_VARS['fillFields'])) { $sql="INSERT INTO [FieldsUsed] (field,tablen, descript) VALUES ('$col', '$tablen','$des')"; odbc_exec($odbc_connect,$sql); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=11974&edit=1

« previous php.bugs (#11978) next »