SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dreamweaver Mx/ Table Join

    I need to join a table [will drag all recordset column values over into rows. No need for repeat region on page.]

    Already I have a seperate result page coming from a search menu. This works with the first of the two tables I am using.
    -------------------------------
    SELECT JoID, `Jopot`, Joping FROM posts
    WHERE 'Jopot` LIKE '%colname%'

    NAME: colname
    Default: 1
    $HTTP_Get_Vars['Jopot']

    Table 'Easy' has a primary 'ID' named this way, with:
    ID
    Epos
    EPost
    EClass
    EStart
    EEnd

    note: 'EasID'column appears on this same table 'posts' as a foreign key to table 'Easy' .
    Table 'posts' has:
    JoID (primary, autonumber)
    EasID (foreign to Easy)
    Jopot
    Joping
    --------------------------------------
    I've tried SELECT * many different ways but haven't been able to make this move! I've heard perhaps I should itemize these columns one by one to make them display better (for ordering/renaming column). This right?

    How would MySQL statement read?
    Last edited by datadriven; Feb 24, 2004 at 08:29.

  2. #2
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:
    PHP Code:
    SELECT JoID, `Jopot`, Joping FROM posts
    WHERE 
    `JopotLIKE '%colname%' 
    I changed an ' to an `..the one in WHERE `Jopot

    one more thing, anytime you run a query, do the following:
    mysql_query($sql) or die(mysql_error())
    It helps you identify whether your query is running or not.

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks-

    Do you know how to join the second table with foreign key 'EasID'?

    note: 'EasID' column appears on this same table 'posts' -- as the foreign key to
    a table named 'Easy' -- 'Easy' has a primary 'ID' and which is named this way, with columns: Epos, EPost, EClass, EStart,EEnd

    I'm trying to join columns t both tables, not just "one way"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •