Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Posts
    17

    Unanswered: More than one query on a page?

    I'm trying to add another query to the code below so that I can perform another action in this script instead of one (At the moment its getting profile information, and I want it to display a modify username form but it messes up whatever I try.)

    How can I add/change/etc to the code below

    PHP Code:
    <?php
    include("settings.php");

    $db_name "dbname";

    $table_name "auth_user";

    $connection mysql_connect("localhost""user""pass") or die(mysql_error());

    $db mysql_select_db($db_name$connection) or die(mysql_error());


    $sql "SELECT username, status, email, msn, yahoo, aim, website, interests, biography, location, quote FROM $table_name WHERE id ='$_GET[id]'";

    $result mysql_query($sql$connection) or die(mysql_error());

    while (
    $row mysql_fetch_array($result)) {

    $username stripslashes($row['username']);
    $status stripslashes($row['status']);
    $email stripslashes($row['email']);
    $msn stripslashes($row['msn']);
    $yahoo stripslashes($row['yahoo']);
    $aim stripslashes($row['aim']);
    $website stripslashes($row['website']);
    $interests stripslashes($row['interests']);
    $biography stripslashes($row['biography']);
    $location stripslashes($row['location']);
    $quote stripslashes($row['quote']);
    }







    ?>
    <html><head><body><?php echo "get profile code"?></body></html>
    to add an edit username feature like below into the same file (whatevername.php)???

    PHP Code:
    <?php
    include("settings.php");

    $db_name "dbname";

    $table_name "auth_user";

    $connection mysql_connect("localhost""user""pass") or die(mysql_error());

    $db mysql_select_db($db_name$connection) or die(mysql_error());


    $sql "UPDATE IN $table_name WHERE id ='$_GET[id]'";

    $result mysql_query($sql$connection) or die(mysql_error());

    while (
    $row mysql_fetch_array($result)) {

    $username stripslashes($row['username']);


    }







    ?>
    <html><head><body><?php echo "form code here"?></body></html>
    Anyone know how I can do this? I know it is possible because you see ?action=whatever with different type forms and into to action=muh(different action) with a different form or information.

  2. #2
    Join Date
    Dec 2002
    Posts
    17
    When I stick the two bits of coding together, only the top HTML output is printed (without the information taken from the database ofcourse - different query.)

    Any ideas on how I can solve this?

Posting Permissions

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