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.

Database Problem PHP Mysql

  • 26-02-2012 12:50AM
    #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