[Vtigercrm-developers] Bad use of MySQL calls in modules/Settings/ComboFieldList.php

Michel JACQUEMES m.jacquemes at neuf.fr
Sun Feb 5 02:02:06 PST 2006


Hello everybody,

 

I'm new on this list but have already done some work on VTiger.

Normally this post would go in a help or developer forum but this problem
exists also in V5 and I think it has to be corrected.

In modules/Settings/ComboFieldList.php, function getUserFldArray uses direct
calls to MySQL interface instead of calls to PearDatabase.

This could result in connectivity problems.

 

function getUserFldArray($fld_module)

{

            $user_fld = Array();

            $query = "select * from field where generatedtype=2 and
tabid=".fetchTabIDVal($fld_module)." and uitype IN (15,16)";

//          echo $query;

            $result = mysql_query($query);

            $noofrows = mysql_num_rows($result);

            if($noofrows > 0)

            {

                        for($i=0; $i<$noofrows; $i++)

                        {

 
$user_fld[mysql_result($result,$i,"fieldlabel")] =
mysql_result($result,$i,"columnname");    

                        }

            }

            return $user_fld;

}

 

I replace by :

 

function getUserFldArray($fld_module)

{

            global $adb;

            $user_fld = Array();

            $query = "select * from field where generatedtype=2 and
tabid=".fetchTabIDVal($fld_module)." and uitype IN (15,16)";

//          echo $query;

$result = $adb->query($query);

            $noofrows = $adb->getRowCount($result);

if($noofrows > 0)

{

for($i=0; $i<$noofrows; $i++)

{

$user_fld[$adb->query_result($result,$i,"fieldlabel")] =
$adb->query_result($result,$i,"columnname");            

}

            }

            return $user_fld;

}

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20060205/67cc77f4/attachment-0003.html 


More information about the vtigercrm-developers mailing list