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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:53:45+00:00 2026-06-02T19:53:45+00:00

For the query i need to do, a user uploads videos onto an album,

  • 0

For the query i need to do, a user uploads videos onto an album, on their video page, it has the list of albums, and the total of videos below it.

Currently, what i am trying to do is a union, however this is not working, this is my code:

$query="SELECT albname, albcover, lid, NULL as vidcount FROM albums WHERE USERID='".mysql_real_escape_string($USERID)."' and verified='1'

UNION

SELECT NULL as albname, NULL as albcover, NULL as lid, count(*) as vidcount FROM albs_vids A LEFT JOIN albums B USING(ALBID) WHERE B.USERID='".mysql_real_escape_string($UID)."'";

So, what happens is the SQL query needs to find the data of the album, ie albname, albcover and lid from the table albums. Then find the amount of videos in the table albs_vids which correspond to the album. The album is specified by ALBID in both tables.

  • 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-02T19:53:47+00:00Added an answer on June 2, 2026 at 7:53 pm

    Hard to completely understand what you’re asking ,but this will give you the count of videos for each album that has your userid:

    $sql = "SELECT a.albname, a.albcover, a.lid, COUNT(*) AS vidcount
    FROM albums AS a
    LEFT JOIN albs_vids AS b ON b.albid = a.albid
    WHERE b.userid='".mysql_real_escape_string($UID)."'
    GROUP BY a.albname";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I need is when the user types his query in the search Box.
The below shown is my query I need to order by with these three
I need query which will check user supplied date range is in between the
I'm creating a custom profile page and I need the user to be able
I need an image upload system within the page so that a user can
My project have more than one pages. Suppose in one page user need to
what wrong with this Query ??? i need this Query. UPDATE user_preferences SET user_preferences_value
I need query to get data between two days.I tried with this.But it gives
I am having some trouble building the query I need to return the AccountID
I am just facing trouble to sort out the query I need. I have

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.