LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-04-2010, 10:17 AM   #1
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Rep: Reputation: 0
input articleIDs


ok, bear with me, this is the newbie section and i did do another 4 hours of fail since my last post so, here it goes, i finally made a database called "log"
got the tables_in_log
to show: articles
searchwords

heck, i can even input queries:

insert into articles values(0, 'log' '8/30/10 zcaptain ');

insert into searchWords values(0, 'log', '1');

insert into searchWords values(0, 'ahsim', '1');

insert into articles values(0, 'home', 'home page');


insert into searchWords values(0, 'home', '2');
etc etc

all show
query, OK 1 row affected.
but when i run a search for say,"log" in my new snazzy search box

(courtesy of Whim sturkenboom in my php parshe error link down the page)

and it runs the search but returns:

Query select articleIds from searchWords where word = 'log' failed: Unknown column 'articleIds' in 'field list'


please alleviate my blinding stupidity!

much thanks for reading such a long post
 
Old 09-04-2010, 10:20 AM   #2
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Original Poster
Rep: Reputation: 0
input articleIDs

ok, bear with me, this is the newbie section and i did do another 4 hours of fail since my last post so, here it goes,
with mysql vers 5.1.36, i finally made a database called "log"
got the tables_in_log
to show: articles
searchwords

heck, i can even input queries:

insert into articles values(0, 'log' '8/30/10 zcaptain ');

insert into searchWords values(0, 'log', '1');

insert into searchWords values(0, 'ahsim', '1');

insert into articles values(0, 'home', 'home page');


insert into searchWords values(0, 'home', '2');
etc etc

all show
query, OK 1 row affected.
but when i run a search for say,"log" in my new snazzy search box

(courtesy of Whim sturkenboom in my php parshe error link down the page)

and it runs the search but returns:

Query select articleIds from searchWords where word = 'log' failed: Unknown column 'articleIds' in 'field list'


please alleviate my blinding stupidity!

much thanks for reading such a long post
 
Old 09-04-2010, 11:08 AM   #3
14moose
Member
 
Registered: May 2010
Posts: 83

Rep: Reputation: Disabled
Hi -

Please cut/paste:
a) your exact "select" query
b) "describe YOUR_TABLE" (substute your actual table name for "YOUR_TABLE")
c) the exact error
d) use "code blocks" when you cut/paste

TIA!
 
Old 09-04-2010, 11:11 AM   #4
14moose
Member
 
Registered: May 2010
Posts: 83

Rep: Reputation: Disabled
Please see the other post.

Even if you solved the problem, please cut/paste your original query (and how you solved it) so others can learn.

TIA!
 
Old 09-04-2010, 11:31 AM   #5
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Original Poster
Rep: Reputation: 0
exact error:

Query select articleIds from searchWords where word = 'homepage' failed: Unknown column 'articleIds' in 'field list'

so, article Id's isnt in my field, but i cant find a way to put them there

hard to copy paste from mysql lol,
Code:
SHOW database *results in*: -----------
                             database
                             ----------
                             information
                              content
                               log

use log
*results in*
Database changed

SHOW tables *results in*  --------------
                          tables_in_log
                          --------------
                           articles
                           searchwords

a EXPLAIN searchwords *results in*
-----\-----------\-------\-------\--------\---------\
field type      null    key     default  extr
------\----------\-------\-------\--------\---------\
wordId  int(11)     NO     PRI    NULL     auto_increment
word    varchar(50) YES           NULL
article varchar(255)YES           NULL
also, link above wasnt solved, when i tried to update the first to include my mysql vers, not knowing if that was the issue, it duplicated, so, i marked one as solved as i couldnt find a remove..

sry for the inconvinence
 
Old 09-04-2010, 12:09 PM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Quote:
select articleIds
If this bit are the fields in your table:

Code:
-----\-----------\-------\-------\--------\---------\
field type      null    key     default  extr
------\----------\-------\-------\--------\---------\
wordId  int(11)     NO     PRI    NULL     auto_increment
word    varchar(50) YES           NULL
article varchar(255)YES           NULL
then the problem is that your table doesn't have an "articleID' column. Basically, you're asking for something that doesn't exist.
 
Old 09-04-2010, 12:35 PM   #7
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Original Poster
Rep: Reputation: 0
grok

Quote:
Originally Posted by Hangdog42 View Post
If this bit are the fields in your table:

Code:
-----\-----------\-------\-------\--------\---------\
field type      null    key     default  extr
------\----------\-------\-------\--------\---------\
wordId  int(11)     NO     PRI    NULL     auto_increment
word    varchar(50) YES           NULL
article varchar(255)YES           NULL
then the problem is that your table doesn't have an "articleID' column. Basically, you're asking for something that doesn't exist.
oh i understand that now, ive been looking for a way to modify it, i now have a table "articlesId"
but searchwords still no go, same input, same error
 
Old 09-04-2010, 01:17 PM   #8
14moose
Member
 
Registered: May 2010
Posts: 83

Rep: Reputation: Disabled
Here's what I was trying to ask you:

1. Please Cut/paste exact query (use LQ "code blocks"):
Code:
select articleIds from searchWords where word = 'homepage';
2. Please "describe searchwords;":
Code:
-----\-----------\-------\-------\--------\---------\
field type      null    key     default  extr
------\----------\-------\-------\--------\---------\
wordId  int(11)     NO     PRI    NULL     auto_increment
word    varchar(50) YES           NULL
article varchar(255)YES           NULL
3. Please cut/paste exact error message:
Code:
Query select articleIds from searchWords where word = 'homepage' failed: Unknown column 'articleIds' in 'field list'
Soooooooo ....

As Hangdog42 said: you're asking for something that doesn't exist!

Here's are a couple of alternative queries that should work:
Code:
select wordId from searchWords where word = 'homepage';

select * from searchwords;

select * from searchwords where word = 'homepage';

select wordId, word, article from searchwords where word like 'home%';

...
'Hope that helps

PS:
I'm assuming your table is called "searchwords", and not "articleId".

If you had a table for articles, I'd call it "Articles", or "ArticlesTable"; and "articleId" (or simply "id") would be a COLUMN in your "Articles" table.

PPS:
I've found this book very helpful for learning SQL:
Quote:
SQL Queries for Mere Mortals, by John Viescas and Michael Hernandez
It takes you from "What is SQL" to some fairly sophisticated queries - all pretty painlessly. Very practical; highly recommended!

Last edited by 14moose; 09-04-2010 at 01:31 PM.
 
Old 09-04-2010, 01:31 PM   #9
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Quote:
Originally Posted by zev42
now have a table "articlesId"
but searchwords still no go, same input, same error

Having a table "articlesId" isn't the problem here. Let's parse your query:

Quote:
Query select articleIds from searchWords where word = 'homepage'
The "select artticleIds" says that you're looking for data in the column articleIds. The part "from searchWords" says that the column articleIds lives in the table searchWords. The part "where word = 'homepage'" says that you're looking specifically for the rows in searchWords where the column word has the value "homepage". So at very minimum for this query to work, your table searchWords has to have the columns articleId and word. Given the columns that you have shown us, the queries 14moose posted should work.

Last edited by Hangdog42; 09-04-2010 at 01:33 PM.
 
Old 09-04-2010, 06:02 PM   #10
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Original Poster
Rep: Reputation: 0
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,

Code:
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
Code:
insert into articles values(0, 'log', 'ahsim zcaptain');
then
Code:
insert into searchWords values(0, 'log', '1');
insert into searchWords values(0, 'ahsim', '1')
insert into searchWords values(0, 'zcaptain', '1')
moose14's querys: here are the results

Code:
select wordId from searchWords where word = 'homepage';
*results in*
+------+
word id
+------+
    11
    16
    17
--------
Code:
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
Code:
select * from searchwords where word = 'homepage';
*results in*
wordId | word  | article
-------------------------
11      homepage 2
16      homepage 2
17      homepage 2
now,the last one
Code:
"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

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.

Last edited by zev42; 09-04-2010 at 10:51 PM.
 
Old 09-04-2010, 10:52 PM   #11
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Original Poster
Rep: Reputation: 0
ive been trying to modify the existing searchwords table to include field (articleId)

still no prevailance
 
Old 09-05-2010, 02:25 PM   #12
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
I think this is starting to make some more sense, but I've still got a couple of questions:

- When you create the searchwords table, you create an articleIds field. However, in your dump of the table (select * from searchwords) the field appears as "article". That isn't necessarily a fatal flaw so long as your SQL statements use article.

-Am I correct in assuming that the article field in searchwords is the same data as articleID in the articles table?

Assuming this is the case, the following might do what I think you're after

Code:
SELECT a.articleID FROM articles a, searchwords b WHERE b.word='homepage' AND a.articleID=b.article
Essentially since you want results from your articles table, but are querying using data in your searchwords table, you have to construct a query that tells SQL how the two tables relate.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HAL vs Xserver (/dev/input/mice?): convincing X to *not* use a given input device? stuartnlevy Linux - Desktop 6 01-24-2012 05:06 PM
Repeated "input: AT Translated Set 2 keyboard as /class/input/input" messages AcerKev Mandriva 2 09-16-2007 09:35 AM
Ctrl+Shift Unicode input gone, after installing Japanese Input Methodes polemon Linux - Newbie 1 09-20-2005 06:17 PM
Sendmail: timeout waiting for input from local during Draining Input andrewstr Linux - Software 0 07-14-2004 02:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration