Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    calling from-1 database, 2 tables

    U guys are great! thanks for all your help here

    OK, what if I want to call from 1 database, from 2 fields in 2 diff tables?

    how would i select them?

    for php output.. I got calling one down from one table..but now from 2 diff tables

    thanks again

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks guys/girls, you are extremely beneficial to the community. That was a great site, and extremely helpful. The problem I have is just not know what the variables, and stuff are actually called..So it is hard to search through a million pages on the web looking. THANKS AGAIN !!!

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Well you need to provide us with more than just talking about it otherwise we can't help. Right now all I can do is say the same thing you can find in that tutorial I posted:

    SELECT table1.field1, table2.field1 FROM table1, table2 WHERE where condition here;
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol am sorry . I will think of that next time, but it wont go :-( I am missing something

    <?
    $db_name = "user_mapforum";
    $table_name = "ibf_post";
    $table_name2 = "ibf_topics";
    $connection = @mysql_connect("localhost", "user name", "pass") or die("Couldn't Connect.");
    $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
    $sql = "SELECT ibf_posts.ibf_posts, ibf_topics.title FROM $table_name, $table_name2
    WHERE ibf_topics.title = ibf_posts.post_date";
    $result = @mysql_query($sql, $connection) or die("Couldn't execute query.");
    while ($row = mysql_fetch_array($result)) {
    $ibf_topics = $row['ibf_topics'];
    $ibf_posts = $row['ibf_posts'];
    $display_title .= "<p><strong>$ibf_topics</strong></p>";
    $display_post .= "<p><strong>$ibf_posts</strong></p>";
    }
    ?>

    I keep getting couldnt execute query..I think ..well I am missing something..I am calling with echo command on another page using the $display

    ohh well I hope people can sort through that mess. thanks

  • #6
    New Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Umm Im lost hellp lol, I still can not figure where my error is

  • #7
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Try hardcoding your table names in first. If the query cannot find the tables then that will stop it from running.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •