Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

having trouble with query - mySQL & PHP

Status
Not open for further replies.

sm43

Programmer
Dec 1, 2002
155
US
I'm using mySQL 3.23 on UNIX and PHP for programming. I'm either overlooking something
really simple, or this query is suppose to be indeed complicated. Or I'm finding it hard
to do because of the absense of nested queries in mySQL. Nevertheless, I'm quite lost,
and need somebody's pro eye to guide me. I've spent quite a few hours thinking about this query.


Thanks in-advance.


Saad
 
show us the query and we might be able to help *cheesy grin* Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Sorry, I copy & pasted from notepad - and my paste got cut off. Here is what I meant to post:



Hi,
I have created a temporary table (with a query that reads from 2 permanent tables) that lists items and its keywords. Each row defines relationship between one item and one keyword. e.g

Item Keyword

item1 keyword1
item2 keyword2
item3 keyword3
item1 keyword2
item3 keyword2


I want to display these items and keywords in an html table. Each unique item will be in one row of the html table, & ALL of it's keywords will be shown next to it stringed together with commas.

e.g.

item1 keyword1, keyword2

item2 keyword2

item3 keyword3, keyword2


I'm using mySQL 3.23 on UNIX and PHP for programming. I'm either overlooking something really simple, or this query is suppose to be indeed complicated. Or I'm finding it hard to do because of the absense of nested queries in mySQL. Nevertheless, I'm quite lost, and need somebody's pro eye to guide me. I've spent quite a few hours thinking about this query.

Thanks in-advance.


Saad
 
do a SELECT for each item with something like

SELECT keyword FROM tablename WHERE item="item1"

and then write the stuff it retrieved to the row.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top