Outputting Data

I am creating a system where i input how much paper each of my photocopiers have used per user.
I have created the database and tables which all seems to work fine. I have a simple drop down menu where i select the photocopier i am inputting the count from and user and which photocopier as we have 4. This then writes to a table with all that data including date and month so i can report for each month in question.
My issue is when displaying the data it outputs each line and as i have multiple copiers i will write a line for each entry that i have made. Can i have this display per user and copier all on one line instead of a line per entry.
I this just a simple case of changing my sql query or do i need to change the way i am writing the data to the database ?
I hope below helps.

I have

User 1 FirstName1 LastName1 CopierMachine1 count1
User 1 FirstName1 LastName1 CopierMachine2 count2
User 2 FirstName2 LastName2 CoperMachine1 count1
User 2 FirstName2 LastName2 CopierMachine2 count2

I would like

User 1 Firstname Lastname CopierMachine1 Count1 CopierMAchine2 Count2
User 2 Firstname Lastname CopierMachine2 Count1 CoperMAchine2 Count2

Could you post your current query?

This is the current output query.

[php]//Start initial query from database
$srch="%".$search."%";
$result = mysql_query(“SELECT * FROM counts where month = $monthnum order by username asc”);

echo "

";

While ($r = mysql_fetch_array($result)) {
$username = $r[“username”];
$forename = $r[“forename”];
$surname = $r[“surname”];
$site = $r[“site”];
$dept = $r[“dept”];
$count = $r[“count”];
$location = $r[“location”];
$copiersite = $r[“copiersite”];
$added = $r[“added”];

echo "

"; }

?>[/php]

Username First Name Last Name Home Site Department Count Location Copier Site Added
$username $forename $surname $site $dept $count $location $copiersite $added

You are using deprecated code (Obsolete). If you can provide an sql dump of your tables and a few sample records I will write you a PDO solution. Also provide the form you are using. The easier you make it to help you the quicker you will have a solution.

** You should not be using this code.

Sponsor our Newsletter | Privacy Policy | Terms of Service