Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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

  • 09-02-2009 06: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, Registered Users 2 Posts: 21,277 ✭✭✭✭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