php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11974 Pb with odbc_columns(); the 12th result(description)has a incorrect format
Submitted: 2001-07-09 08:00 UTC Modified: 2002-07-25 01:00 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: moditii at yahoo dot fr Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 4.0.6 OS: Windows 98
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: moditii at yahoo dot fr
New email:
PHP Version: OS:

 

 [2001-07-09 08:00 UTC] moditii at yahoo dot 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);
                     }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-24 17:38 UTC] kalowsky@php.net
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.  
 [2002-07-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 10 03:01:25 2020 UTC