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 6870463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:41:12+00:00 2026-05-27T03:41:12+00:00

I have an admin area in an ecommerce website whereby the admin can view

  • 0

I have an admin area in an ecommerce website whereby the admin can view all users on the allusers.php page. The users are listed in a table with their personal information, however i have a ‘view profile’ button near each user whereby if you was to click on it, it would take you to another page where you can view that specific users past orders.

the following is the code i have for allusers.php:

    <?php

$result = mysql_query("SELECT * FROM customers ")
or die(mysql_error()); ;

if (mysql_num_rows($result) == 0) {
       echo 'There Arent Any Orders Yet';
    } else {

echo "<table border='0'><table border width=100%><tr><th>First Name</th><th>Surname</th><th>Address</th><th>E-Mail</th><th>Username</th><th>View Profile</th>";
while($info = mysql_fetch_array($result))
{
        echo "<tr>";
        echo "<td>" . $info['name']. "</td>";
        echo "<td>" . $info['surname']. "</td>";
        echo "<td>" . $info['address1']. $info['address2'].  $info['city'].  $info['postcode']." </td>";
        echo "<td>" . $info['email']. "</td>";
        echo "<td>" . $info['username']. "</td>";
        echo "<td>" . " <a href='view.php'>View</a> </td>";


}
    }
echo "</tr>";
echo "</table>";
?>

the view.php page is as follows:

<?php


$result = mysql_query("SELECT * FROM order WHERE ......dont know what to enter here")
or die(mysql_error()); ;

if (mysql_num_rows($result) == 0) {
       echo 'There Arent Any Orders For This Customer Yet';
    } else {

echo "<table border='0'><table border width=100%><tr><th>Product</th><th>Quantities</th><th>Date</th>";
while($info = mysql_fetch_array($result))
{
        echo "<tr>";
        echo "<td>" . $info['name']. "</td>";
        echo "<td>" . $info['quantity']. "</td>";
        echo "<td>" . $info['date']. " </td>";
}
    }
echo "</tr>";
echo "</table>";
?>

I have a mysql database with the following fields & tables:

Customers – id, name, surname, address1, address2, city, postcode, email, username, password

Products – serial, name, description, price, picture

Order – id, name, quanitity, price, date, username

Thanks for any help provided

  • 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-05-27T03:41:13+00:00Added an answer on May 27, 2026 at 3:41 am

    A simple method could be the follow. Replace this line in alluser.php

    echo "<td>" . " <a href='view.php'>View</a></td>";
    

    with this one

    echo '<td><a href="view.php?username=' . $info['username'] . '">View</a></td>';
    

    and then, in your view.php have

    if (isset($_GET['username']) && $_GET['username'] != '')
    {
       $username = mysql_real_escape_string($_GET['username']);
       $result = mysql_query("SELECT * FROM order WHERE username = '$username'");
    }
    else
    {
      // No user specified. Do other statements
    }
    

    Please note the use of:

    1. The user of the mysql_real_escape_string() function to protect from Sql injection (would be better the use of a prepared statements)
    2. The use of the parameter username in the first page to pass the value of the username to the second page
    3. The use of the $_GET global array to retrieve the parameter
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If have an admin area where users can select a category name and an
I have a website admin area I want to protect with a password.. so
I'm building out an admin area for an ecommerce site where the user can
I have a fully functioning website with user accounts/profiles and admin area. I would
I have a website built with CodeIgniter which, for the admin area, is using
I have an admin view which contains four foreign keys each with a few
I have an admin form that lets users create entities that require an image.
Hey guys I have an admin page that checks if you are admin before
Hi Sitepoint wizard people, Say we have an admin application that has multiple users
I have an Area called Admin. The folder structure in Visual Studio is this:

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.