SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    Berlin
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    two sql tables with ID fields - how to change the name of one?

    I'm having two tables (kabul_fotos and kabul_fotos_kat), both have a field "id". I need to call the id field of only one table (kabul_fotos) to edit the right data set.

    --
    I calling the mySQL database:
    PHP Code:
    $result = @mysql_query("SELECT * FROM kabul_fotos, kabul_fotos_kat WHERE kabul_fotos.kat_id=kabul_fotos_kat.id Order by datum"); 
    [...]
    And want to edit the right set:
    PHP Code:
    <?="<a href='edit.php?id=$id'>Edit</a>"?>
    --

    The problem is, that it shows me the ID of the wrong table (kabul_fotos_kat)...

    Thus I tried to rename the ID field of one table like this:
    PHP Code:
    $result = @mysql_query("SELECT * kabul_fotos.id AS foto_id FROM kabul_fotos, kabul_fotos_kat WHERE kabul_fotos.kat_id=kabul_fotos_kat.id Order by datum"); 
    But it seems like this is not the right way... "kabul_fotos.id AS foto_id" dosn't work.

    Can someone help me - how do I do this?

    Thanks
    Fl÷zen
    Last edited by Floezen; May 20, 2003 at 13:39.


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
  •