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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:25:08+00:00 2026-06-14T02:25:08+00:00

Alright, I have no problem outputting multiple lines of data out of the database,

  • 0

Alright, I have no problem outputting multiple lines of data out of the database, I just have no idea how to get it out in the format I want.

Here’s my basic issue.

<tr>
    <?php               
    //make connection to database, bail if no connection
    $connection = odbc_pconnect('sitedata','','');
    if (!$connection) { exit("Connection Failed: " . $connection); }

    //retrieve relevant data
    $Date = "SELECT EntryDate AS DT FROM TimeSheet WHERE EmployeeID = 'AA01'";

    $rs = odbc_exec($connection, $Date);

    //output data
    while(odbc_fetch_row($rs)) {
        $Line1 = odbc_result($rs, 'DT');
        printf("<td><center>%s</center></td>", $Line1);                 
    }
    ?>
</tr>

What this will do is output a one row table, with each new date creating a new column.

Now then, this is sort of useless to me as these need to be output into a single column, where each new datavalue is the beginning of a row. After this, I need to expand the table width wise, adding new data values such as:

$Time = "SELECT TotalTime as EN FROM TimeSheet WHERE EmployeeID = 'AA01'";
$JobName = "SELECT JobName as JN FROM TimeSheet WHERE EmployeeID = 'AA01'";

Where Time is it’s own column, JobName is it’s own column, etc.

How exactly do I do this? There obviously must be a way, I’m just new at this. Any help is greatly, greatly appreciated!

  • 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-14T02:25:09+00:00Added an answer on June 14, 2026 at 2:25 am

    You need to get the fields in one SQL statement…

    SELECT EntryDate AS DT, TotalTime as EN, JobName as JN 
        FROM TimeSheet WHERE EmployeeID = 'AA01';
    

    With that you can do exactly what you are doing now except build a full row instead of columns.

    <?php               
        //make connection to database, bail if no connection
        $connection = odbc_pconnect('sitedata','','');
        if (!$connection) { exit("Connection Failed: " . $connection); }
    
        //retrieve relevant data
        $Date = "SELECT EntryDate AS DT, TotalTime as EN, JobName as JN FROM TimeSheet WHERE EmployeeID = 'AA01';";
    
        $rs = odbc_exec($connection, $Date);
    
        //output data
        while(odbc_fetch_row($rs)) {
            $DT = odbc_result($rs, 'DT');
            $EN = odbc_result($rs, 'EN');
            $JN = odbc_result($rs, 'JN');
    
            printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>", $DT, $EN, $JN);                 
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, title is REALLY sloppy. Here's my problem: I have a news site and
Alright, so I have this problem where you can glitch to get more than
Alright so here is my problem. Basically I have a string with 4 words
alright so i have a small problem here, i have this here. - (void)alertView:(UIAlertView
Alright so my problem is that I have no idea where to go in
Alright, this problem is a little complicated, so bear with me. I have a
Alright so I have no idea how to even begin doing this But basically
Alright so I have been trying to get all of my separate classes (At
Alright, so heres my problem: I have an application I am working with that
Alright, I have ran into a problem when using DownloadDataAsync and having it return

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.