From:             [EMAIL PROTECTED]
Operating system: Windows 98
PHP version:      4.0.6
PHP Bug Type:     ODBC related
Bug description:  Pb with odbc_columns(); the 12th result(description)has a incorrect 
format 

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 bug report at: http://bugs.php.net/?id=11974&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to