Mun pitäisi hakea kahdesta tablesta mysql tietokannasta tavaraa hakukoneella (DGS search), mut saan tälläistä erroria:
Column: 'id' in field list is ambiguous
Ok. Saan homman toimimaan jos haen yhtä tablea tietokannasta, mutta heti kun pitää hakea 2:sta tablesta se herjaa tota. DGS:n install fileestä sain jeesinkiä tälläin:
$database[x]["table"] - Datatype: (Array of String) - Ex: array("article", "magazine")
The name of the table(s) in your database to search. In most cases, you will only be
searching one table.
If more than one table is listed in the "table" array, then DGS Search will attempt to do
an SQL join based on $database[x]["tableAssoc"].
If you had the SQL statement:
SELECT * FROM article, magazine WHERE field = 1;
The "table" array is used to build the "article, magazine" section of that statement.
$database[x]["tableAssoc"] - Datatype: (String) - Ex: "article.magazineid = magazine.magazineid"
A string of rules for associating the records in multiple tables. If you
are only searching one table, set this value to the empty string.
If you had the SQL statement:
SELECT * FROM article, magazine WHERE article.magazineid = magazine.magazineid;
The "tableAssoc" is used to build the "article.magazineid = magazine.magazineid" section
of that statement.
-------------------------------
tässä oma vääntö tällähetkellä
-------------------------------
$database[0]['table'] = array('perus', 'uutiset'); /* The table in database to search. */
$database[0]['tableAssoc'] = ''; /* If multiple tables listed, is used to join the tables. See INSTALL. */
Eli tohon viimeseen pitäis jotain vääntää, mutta en tajua mitä...
Osaako kukaan sanoa mitä pitäis tehdä *aargh*
T. esq
Column: 'id' in field list is ambiguous
Ok. Saan homman toimimaan jos haen yhtä tablea tietokannasta, mutta heti kun pitää hakea 2:sta tablesta se herjaa tota. DGS:n install fileestä sain jeesinkiä tälläin:
$database[x]["table"] - Datatype: (Array of String) - Ex: array("article", "magazine")
The name of the table(s) in your database to search. In most cases, you will only be
searching one table.
If more than one table is listed in the "table" array, then DGS Search will attempt to do
an SQL join based on $database[x]["tableAssoc"].
If you had the SQL statement:
SELECT * FROM article, magazine WHERE field = 1;
The "table" array is used to build the "article, magazine" section of that statement.
$database[x]["tableAssoc"] - Datatype: (String) - Ex: "article.magazineid = magazine.magazineid"
A string of rules for associating the records in multiple tables. If you
are only searching one table, set this value to the empty string.
If you had the SQL statement:
SELECT * FROM article, magazine WHERE article.magazineid = magazine.magazineid;
The "tableAssoc" is used to build the "article.magazineid = magazine.magazineid" section
of that statement.
-------------------------------
tässä oma vääntö tällähetkellä
-------------------------------
$database[0]['table'] = array('perus', 'uutiset'); /* The table in database to search. */
$database[0]['tableAssoc'] = ''; /* If multiple tables listed, is used to join the tables. See INSTALL. */
Eli tohon viimeseen pitäis jotain vääntää, mutta en tajua mitä...
Osaako kukaan sanoa mitä pitäis tehdä *aargh*
T. esq
Vastaukset 2
Vanhimmat
Virheilmoituksessasi "Column: 'id' in field list is ambiguous" tuo sana "ambiguous" tarkoittaa moniselitteistä. Eli: tietokanta ei tiedä, mitä id-kenttää tarkoitat. Ilmeisesti id-kenttä löytyy monesta eri taulusta.
muokkaa hakuasi siten, että id-kenttään tehdyt viittauksen pitävät sisällään myös taulunimen. Esim näin:
select taulu1.id, taulu2.id from taulu1, taulu2 where taulu1.id = 'asdf';
No nyt futaa... Suur kiitokset ;0)