Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Database Problem PHP Mysql

  • 25-02-2012 11:50PM
    #1
    Closed Accounts Posts: 2


    Hi All,

    Lets say i have a 2 tables
    Table1
    ID(int)
    Name(varchar)

    Table2
    ID2(int)

    ID = ID2

    So on a page if i have ID2 on table 2, i would like to display Name on table1, how would i go about doing this?
    Sorry if it is a bit confusing but let me know if you are confused.


Comments

  • Registered Users, Registered Users 2 Posts: 131 ✭✭CuAnnan


    DevF wrote: »
    Hi All,

    Lets say i have a 2 tables
    Table1
    ID(int)
    Name(varchar)

    Table2
    ID2(int)

    ID = ID2

    So on a page if i have ID2 on table 2, i would like to display Name on table1, how would i go about doing this?
    Sorry if it is a bit confusing but let me know if you are confused.
    What, you mean a join?


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    If you have ID2 in a variable all you need is a WHERE sql lookup...


  • Closed Accounts Posts: 2 DevF


    Yea Id2 is a variable, would you mind writing out the sample code in php?


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    http://www.coursesweb.net/php-mysql/php-mysql-where-like

    There's a million examples out there, best that you read a bit more about it rather than just get the answer given to you.


Advertisement