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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:48:12+00:00 2026-05-26T22:48:12+00:00

I am new to PHP and trying to learn some so sorry if this

  • 0

I am new to PHP and trying to learn some so sorry if this seems like too easy a question! anyway lets say I have 2 tables –

  • ID & author
  • ID, joke and AID (supposed to be Author ID)

I want to display each author and each joke they have written all on the same page

Author

  • joke
  • joke
  • joke

Author

  • joke
  • joke
  • joke

How would I go about doing this? I just can’t figure it out and I don’t know how to google it because I don’t know how to word it. If anyone could point me in the right direction that would be super. Thanks!

  • 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-26T22:48:13+00:00Added an answer on May 26, 2026 at 10:48 pm

    1. You query all the jokes with their respective author

        SELECT j.joke, a.author, a.id auth_id
          FROM Jokes j
    INNER JOIN Authors a
            ON j.AID = a.ID
      ORDER BY a.ID
    

    2. Iterate over the results and output it

    $last_author_id = -1;
    while($row /* your weapon of choice */){
        if($row['auth_id'] != $last_author_id){
            $last_author_id = $row['auth_id'];
            echo $row['author'];
        }
        echo $row['joke'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im new in PHP and im trying to write simple online shop. Lets say
I'm quite new on php and am trying to learn it. My question is
I'm trying to learn how to use oop in php. I'm also fairly new
I am new to php and I am getting this error trying to load
I'm new to PHP and i was trying to learn mod rewrite to rewrite
Firstly, I should say I'm completely new to Pylons, trying to learn web development
I'm trying to learn object oriented PHP by porting some of the simple exercises
i'm quite new to php and trying to learn. I have 2 similiar classes.
I'm new to YQL, and just trying to learn how to do some fairly
I've trying to learn PHP OOP and have made some research on how to

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.