Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9303323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:27:31+00:00 2026-06-18T23:27:31+00:00

hey i am new here any one can help me with this chunk of

  • 0

hey i am new here any one can help me with this chunk of code in php and mysql
i know that this is a little mistake but i could not know where is the error and thank you.
this is the code :

//index.php

<html>
<head>
<title>Search for a user</title>
</head>
<body>
<h2> Search for a user below:</h2><br /><br />
<form action="profileprocess.php" method="get">
  <table>
   <tr>
    <td>Username:</td><td><input type="text" id="username" name="username" /></td></tr>
    <tr>
    <td><input type="submit" name="submit" id="submit"  value="View Profile" /></td>
    </tr>


  </table>


</form>
</body>
</html>

// profileprocess.php

<html>
<head>
<title><?php echo $username; ?> <?php echo $lastname; ?>s profile</title>

</head>
<body>
<?php
 if(isset($_GET['username'])){

    $username = $_GET['username']; 
    mysql_connect("localhost", "root", "") or die ("could not connect t the server");
    mysql_select_db("users") or die("this database was not found");
    $userquery = mysql_query("SELECT * FROM users WHERE username='$username'") or die("the query could be fale please try again");
    if(mysql_num_rows($userquery) != 1){
        die("that username could not be found!");
    }
    while($row = mysql_fetch_array($userquery, MYSQL_ASSOC)){
       $firstname = $row['firstname'];
       $lastname = $row['lastname'];
       $email = $row['email'];
       $dbusername = $row['username'];
       $activated = $row['activated'];
       $access = $row['access'];
       }
       if($username != $dbusername){
         die ("there has been a fatal error please try again. ");
       }
       if($activated == 0){
        $active = "this account has not been activated";
       }else{
          $active = "ths  account has been activated";
       }

       if($access == 0){
         $admin = "this user is not administrator";
       }else{
         $admin = "this user is  an administrator";
       }
?>
<h2><?php echo $username; ?> <?php echo $lastname; ?>s profile</h2>
<table>
<tr>
<td>firstname:</td><td><?php echo $firstname; ?></td>
</tr>
<tr>
<td>lastname:</td><td><?php echo $lastname; ?></td>
</tr>
<tr>
<td>email:</td><td><?php echo $email; ?></td>
</tr>
<tr>
<td>username:</td><td><?php echo $dbusername; ?></td>
</tr>
<tr>
<td>activated:</td><td><?php echo $active; ?></td>
</tr>
<tr>
<td>access:</td><td><?php echo $admin; ?></td>
</tr>

</table>


<?php      
 }else die("You need  to specify a username!");


?>

</body>
</html>

//// any help????

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:27:32+00:00Added an answer on June 18, 2026 at 11:27 pm

    I just run this code on my XAMPP server and it seems to work fine.

    <html>
    <head>
    <title>Search for a user</title>
    </head>
    <body>
    <h2> Search for a user below:</h2><br /><br />
    <form action="" method="get">
      <table>
       <tr>
        <td>Username:</td><td><input type="text" id="username" name="username" /></td></tr>
        <tr>
        <td><input type="submit" name="submit" id="submit"  value="View Profile" /></td>
        </tr>
    
    
      </table>
    
    
    </form>
    </body>
    </html>
    
    <?php
     if($_GET['username'] != ''){
         echo $_GET['username'];
    
     } else 
     die('doesnt work'); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey trying to read stream into image control can any one help also I
Hey I'm new to java servlets and I am trying to write one that
Hey guys I wanted to know if i could get a little help: Im
The photo (please view): Example Hey guys, I'm new here.. I'm also new to
Hey guys I'm new to C# and I'm a little confused on the fields
hey people I'm new at jquery and i have been trying to figure this
Hey I am currently using the following code Dim flickr As New Flickr(apikey) Dim
Hey, I'm pretty new to linux (using Ubuntu 11.04) so bear with me here.
Hey all need a lil help sorting a loop for this table out, cant
Here's my code: <?php class Test_Class { public function Show() { return Test_Class->Show() function;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.