Database error

I am trying to work on the affiliate system

When I am in the Admin Panel and go to Users -> Affiliates

The headings are

D   Name  Email   Percent   Memb  Status  Fin

When I click the number in the Memb column - I get a Database error and the page url is:

http://xxxxxx.com/admin/profiles.php?showAffMembers=2

Also when I select the Fin column to check on the transactions - it does not show any payments that an affiliates referred member has made.

Thanks

Quote · 22 Oct 2008

Hi Dartin,

 

Please go to your header.inc.php and check the email that is setup. Check that email address and you should get an email regarding the database error. This will tell you why that is happening.

 

Regards,

 

Dolphin Geeks

http://www.dolphingeeks.com

Quote · 22 Oct 2008

Thanks - I found it and perhaps you can give me an idea what the error is as I have no programming/php experience

(I have removed any reference to my site name)

Database error in Final test
Query:

SELECT
`Profiles`.`ID` as `ID`,
`NickName`,
`Email`,
`Sex`,
DATE_FORMAT(`DateLastLogin`,  '%m-%d-%y %H:%i' ) AS `DateLastLoginCur`,
DATE_FORMAT(`DateReg`,  '%m-%d-%y %H:%i' ) AS `DateReg`,
`Status`
, `IDLevel`, IF(ISNULL(`MemLevels`.`Name`),

'', `MemLevels`.`Name`) AS `MemName`
FROM `Profiles`
,aff_members

LEFT JOIN `ProfileMemLevels` ON `ProfileMemLevels`.`IDMember` = `Profiles`.`ID`
LEFT JOIN `MemLevels` ON `ProfileMemLevels`.`IDLevel` = `MemLevels`.`ID`
WHERE
1   AND idAff = 2 AND idProfile = ID    AND (`Couple`=0 OR `Couple`>`Profiles`.`ID`)

GROUP BY `Profiles`.`ID`
ORDER BY DateLastLogin
LIMIT 0, 30


Mysql error:
Column 'ID' in where clause is ambiguous

Found error in file /home/mywebsite.com/public_html/admin/profiles.php
at line 268. Called db_res function
with erroneous argument #0

Debug backtrace:
Array
(
[1] => Array
(
[file] => /mywebsite.com/public_html/admin/profiles.php
[line] => 268
[function] => db_res
[args] => Array
(
[0] =>
SELECT
`Profiles`.`ID` as `ID`,
`NickName`,
`Email`,
`Sex`,
DATE_FORMAT(`DateLastLogin`,  '%m-%d-%y %H:%i' ) AS `DateLastLoginCur`,
DATE_FORMAT(`DateReg`,  '%m-%d-%y %H:%i' ) AS `DateReg`,
`Status`
, `IDLevel`, IF(ISNULL(`MemLevels`.`Name`),'', `MemLevels`.`Name`) AS `MemName`
FROM `Profiles`
,aff_members

LEFT JOIN `ProfileMemLevels` ON `ProfileMemLevels`.`IDMember` = `Profiles`.`ID`
LEFT JOIN `MemLevels` ON `ProfileMemLevels`.`IDLevel` = `MemLevels`.`ID`
WHERE
1   AND idAff = 2 AND idProfile = ID    AND (`Couple`=0 OR `Couple`>`Profiles`.`ID`)

GROUP BY `Profiles`.`ID`
ORDER BY DateLastLogin
LIMIT 0, 30

)

)

)


Called script: /admin/profiles.php

Request parameters:
Array
(
[showAffMembers] => 2
[sortor] => DateLastLogin
[affID] => 2
[affPassword] => 8115de544f81d70cc53b0c210005469f
[ZP_CAL] => \'fdow\':null,\'history\':\"2008/10/22/09/45,2008/10/21/09/06\",\'sortOrder\':\"asc\",\'hsize\':9
[idAff] => 2
[adminID] => testadmin
[adminPassword] => ccccccccccxxxxxxxxx
Quote · 22 Oct 2008

Usually enough to understand SQL errors - just SQL request and error of SQL, like yours

Mysql error:
Column 'ID' in where clause is ambiguous

.. so last part not so important to explain error

as example you can read this too

http://www.phpbuilder.com/board/showthread.php?p=10721117

here explaining of this error

So, Column 'ID' in where clause is ambiguous is mean that SQL was confused


He don`t know exactly which ID need use in place:

ND idAff = 2 AND idProfile = ID AND

from table `Profiles`, `MemLevels` ?

You should specify exact table name here

Quote · 23 Oct 2008

I notice that this error present in dolphin now, so decide to fix it

open your

admin/profiles.php

locate here next code:

$aff_part_w = " AND idAff = $showAffMembers AND idProfile = ID";

and replace to

$aff_part_w = " AND `idAff` = '{$showAffMembers}' AND `idProfile` = `Profiles`.`ID`";

done, problem must disappear

Quote · 23 Oct 2008

Thank you :)

Quote · 23 Oct 2008

I changed the code as suggested - went back to the admin panel and clicked on the Affiliates link - once again when I tried to view the number of members an affiliate  has I got a database error:

Database error in Demo Site
Query:

SELECT
`Profiles`.`ID` as `ID`,
`NickName`,
`Email`,
`Sex`,
DATE_FORMAT(`DateLastLogin`,  '%m-%d-%y %H:%i' ) AS `DateLastLoginCur`,
DATE_FORMAT(`DateReg`,  '%m-%d-%y %H:%i' ) AS `DateReg`,
`Status`
, `IDLevel`, IF(ISNULL(`MemLevels`.`Name`),

'', `MemLevels`.`Name`) AS `MemName`
FROM `Profiles`
,aff_members

LEFT JOIN `ProfileMemLevels` ON `ProfileMemLevels`.`IDMember` = `Profiles`.`ID`
LEFT JOIN `MemLevels` ON `ProfileMemLevels`.`IDLevel` = `MemLevels`.`ID`
WHERE
1   AND `idAff` = '1' AND `idProfile` = `Profiles`.`ID`    AND (`Couple`=0 OR `Couple`>`Profiles`.`ID`)

GROUP BY `Profiles`.`ID`
ORDER BY DateLastLogin
LIMIT 0, 30


Mysql error:
Unknown column 'Profiles.ID' in 'on clause'

Found error in file /home/mysite/public_html/admin/profiles.php
at line 268. Called db_res function
with erroneous argument #0

Debug backtrace:
Array
(
[1] => Array
(
[file] => /home/mysite/public_html/admin/profiles.php
[line] => 268
[function] => db_res
[args] => Array
(
[0] =>
SELECT
`Profiles`.`ID` as `ID`,
`NickName`,
`Email`,
`Sex`,
DATE_FORMAT(`DateLastLogin`,  '%m-%d-%y %H:%i' ) AS `DateLastLoginCur`,
DATE_FORMAT(`DateReg`,  '%m-%d-%y %H:%i' ) AS `DateReg`,
`Status`
, `IDLevel`, IF(ISNULL(`MemLevels`.`Name`),'', `MemLevels`.`Name`) AS `MemName`
FROM `Profiles`
,aff_members

LEFT JOIN `ProfileMemLevels` ON `ProfileMemLevels`.`IDMember` = `Profiles`.`ID`
LEFT JOIN `MemLevels` ON `ProfileMemLevels`.`IDLevel` = `MemLevels`.`ID`
WHERE
1   AND `idAff` = '1' AND `idProfile` = `Profiles`.`ID`    AND (`Couple`=0 OR `Couple`>`Profiles`.`ID`)

GROUP BY `Profiles`.`ID`
ORDER BY DateLastLogin
LIMIT 0, 30

)

)

)


Called script: /admin/profiles.php

Request parameters:
Array
(
[showAffMembers] => 1
[sortor] => DateLastLogin
[ZP_CAL] => \'fdow\':null,\'history\':\"2008/10/22/09/45,2008/10/21/09/06\",\'sortOrder\':\"asc\",\'hsize\':9
[idAff] => 2
[adminID] => admin
[adminPassword] => 8115de544f81d70cc53b0c210005469f
)

Quote · 23 Oct 2008
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.