MySQL Forums
Forum List  »  MySQL Query Browser

unable to create field articleId in searchWords
Posted by: zev goryn
Date: September 04, 2010 08:40PM

i am not asking for a handout, i have been and continue to try, but, ive been stumped for a day and a half, over something other forums wont help w/
-----------------------------------
alright, so, i know its requesting a column article ids that dont exist.
i 'll include the entire mysql i had done initially,

create database log;

use log;

create table articles

(

articleId int auto_increment,

title varchar(50) not null,

content text,

primary key(articleId),

unique id(articleId)

);

create table searchWords

(

wordId int auto_increment,

word varchar(50),

articleIds varchar(255),

primary key(wordId),

unique id(wordId)

);

i created the initial search words entering
insert into articles values(0, 'log', 'ahsim zcaptain');
then
insert into searchWords values(0, 'log', '1');
insert into searchWords values(0, 'ahsim', '1')
insert into searchWords values(0, 'zcaptain', '1')

a few basic querys here are the results


select wordId from searchWords where word = 'homepage';
*results in*
+------+
word id
+------+
    11
    16
    17
--------

select * from searchwords;
+-----------------------------+
wordID| word       | article  |
+-----------------------------+
     1    log        1
     2    ahsim      1
     3    zcaptain   1
     4     home      2
     5    about      3
     6    home       2
     7    log         1
     8    ahsim      1
     9   zcaptain    1
     10 home         2
     11 homepage      2
     12 log         1
     13 ahsim      1
     14 zcaptain    1
     15 home         2
     16 homepage      2
     17 homepage      2
     18  log        1
     19 ahsim      1
     20 zcaptain    1
     21 home        1
     22 log        1
     23 ahsim      1
     24 zcaptain   1
     25 home        2
     26 home        2
select * from searchwords where word = 'homepage';
*results in*
wordId | word  | article
-------------------------
11      homepage 2
16      homepage 2
17      homepage 2
now,the last one
 "select wordId, word, article from searchwords where word like 'home%';"
this one just brings up every "home" i listed beforehand

now, obviously every time i "insert search word" it registered:D

i just need to know how to add the proper column (articleId?),

and /or affect the column in the right area,

clear all my old homes zcaptain's and the like

basically, i just figured if i wanted to search the word "log" and have it find it, id just: insert intoarticle values (0, log, "1")


but, since ahsim or zcaptain,are also (0, *, "1")
i wanted a search of them to grab log as well,

and a search home or homepage, to both pull the same page since theyre both "2"

is that flawed?

I appreciate all the effort you guys are investing in attempting to enlightenin this fool.

Options: ReplyQuote


Subject
Written By
Posted
unable to create field articleId in searchWords
September 04, 2010 08:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.