Menu

#145 license count does not display

closed
None
5
2004-04-03
2004-02-12
Karl
No

The count_installations function seems to have some
incorrect SQL syntax.

I had to replace

$query = "SELECT sum(lCnt) AS cnt FROM inst_software
WHERE (sID=$sID)";
$sth = $adb->prepare($query);
if($sth)
{
$res = $sth->execute();
$record = $sth->fetchrow_hash();
return $record[cnt];

with

$query = "SELECT * FROM inst_software
WHERE (sID=$sID)";
$sth = $adb->prepare($query);
if($sth)
{
$res = $sth->execute();
return $sth->rows();

from 1.4.1 to make it work again.

Discussion

  • Bryan Ragon

    Bryan Ragon - 2004-02-20

    Logged In: YES
    user_id=188288

    Actually the real problem may be that the upgrade script
    doesn't upgrade all tables properly. At least it didn't for
    me. I had to modify the inst_software table manually:

    alter table inst_software add lCnt int(11) NOT NULL DEFAULT '1'

    and then licenses displayed properly... I also needed to
    modify the software_licenses table

    alter table software_licenses add floating enum ('Yes','No')
    NOT NULL DEFAULT 'No'

    I'll let you know of any others that may need to be modified
    as I find them :)

     
  • Karl

    Karl - 2004-03-02

    Logged In: YES
    user_id=795260

    According to
    http://www.mysql.com/doc/en/Problems_with_alias.html

    "...standard SQL doesn't allow you to refer to an alias in a
    WHERE clause. This is because when the WHERE code is
    executed the column value may not yet be determined."

    which is why I alluded to incorrect SQL syntax.

     
  • Yann Ramin

    Yann Ramin - 2004-04-03
    • assigned_to: nobody --> theatrus
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB