Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How do i update a database entry when i have mapping tables tied in???

Options
  • 09-02-2009 6:16pm
    #1
    Closed Accounts Posts: 73 ✭✭


    Lets say i have a 1 customer and that customer works in 10 counties

    Well how do i retrieve the information from the database so that it shows this customer as
    NAME: Joe Blogs. PLACES OF WORK: Carlow Kildare Dublin Cork and so on

    I entered the information into the database via foreach() because info was in a listbox

    If i use foreach() to put it into DB what do i use to get it out????


Comments

  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    You will have to provide more information before anybody can help you. What is the structure of the tables you are using?


  • Closed Accounts Posts: 73 ✭✭Protype


    Beano wrote: »
    You will have to provide more information before anybody can help you. What is the structure of the tables you are using?


    Database = MySQL
    Created site with = Dreamweaver

    I need to know how to loop the result from the sql query

    I have loads of tables but we will just use two for this, master_info and countymaster_info

    countymaster_info this is a mapping table between master_info and county

    Joe blogs is equal to ID 1 and this is what the mapping table looks like
    CMID
    MIID
    1
    1
    4
    1
    7
    1
    9
    1
    and so on

    When i run my sql in phpmyadmin i get all 1,4,7,9 listed cos they are related to joe blogs

    BUT when i do it in dreamweaver i only get the first "1,"
    Joe Blogs, Kildare
    Should be: Joe Blogs, Kildare, Dublin, Galway, Cork, and so on.


    What the beep do i do cos it is doing my head in.
    please help


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    I'd say you should use two queries. One to get the person's details, and then another one to get the list of assigned counties.


  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    Well now that you've explained the problem further it looks like the problem isnt a sql one as it first looked. Unfortunately thats me out of the picture as i havent a clue about PHP or dreamweaver. Just out of curiosity what sql query are you running to get back the data you want?


  • Closed Accounts Posts: 73 ✭✭Protype


    if (!(strcmp($row_rsCovered, $row_EditCovered)))
    {
    echo "selected=\"selected\"";
    }

    Can anyone tell me how to turn this into a loop


  • Advertisement
Advertisement