Announcement

Collapse
No announcement yet.

PHP Question, MySQL Query, Please Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Question, MySQL Query, Please Help

    Hi, I have a working mysql query below but after some looking into it i can change the query somehow so instead of it being 2 seperate querys for it to work it can be 1 query, can anyone help me please.

    Thank You!
    PHP Code:
    <?php
    {
    $query="SELECT * FROM users WHERE login='".$_SESSION["login"]."'";
    $result=mysql_query($query$link) or die("MySQL query $query failed. Error if any: ".mysql_error());
    $data=mysql_fetch_array($result);
    extract($data);
    }
     
    ?>
    <?php
    {
    $query="SELECT * FROM `group` WHERE `group_name`='$group_name'";
    $result=mysql_query($query$link) or die("MySQL query $query failed. Error if any: ".mysql_error());
    $data=mysql_fetch_array($result);
    extract($data);
    }
     
    ?>

  • #2
    How are these two tables related? If they're related through a foreign key, you can easily do a join statement, can't you?
    :)

    Comment


    • #3
      Hi, I need the bottom query but the only way i can get the bottom query to work is if i use the top query, is this normal

      Comment


      • #4
        You would probably get more answers in the server configuration forum.
        George is a big help over there..
        MCSE, MVP, CCIE
        Microsoft Beta Team

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X