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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:26:25+00:00 2026-06-13T11:26:25+00:00

I am grabbing from a MySQL database some fields and putting them into an

  • 0

I am grabbing from a MySQL database some fields and putting them into an array.
Here is the code:

$dataArray = array();

$query_url = "SELECT * FROM videos";
$query_exec = mysql_query($query_url) or die();

while($res = mysql_fetch_array($query_exec)) {
    echo $dataArray[$res['id']] = $res['video'];
    echo "<br />";      
}

With this I have the printed list of youtube videos taken from my “videos” table, I am trying to get only the last shortcode of youtube, for example:
Here is the youtube link: http://www.youtube.com/watch?v=sN8grtFUQYs
I want to get only the: sN8grtFUQYs

How can I get them from an array that gets the data from a MySQL database automatically?

  • 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-13T11:26:26+00:00Added an answer on June 13, 2026 at 11:26 am

    Probably not really efficient but you could explode() it and call end() to get the last result of the array.

    $dataArray = array();
    
    $query_url = "SELECT * FROM videos";
    $query_exec = mysql_query($query_url) or die();
    
    while($res = mysql_fetch_array($query_exec)) {
        echo $dataArray[$res['id']] = end(explode('?v=',$res['video']));
        echo "<br />";      
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm grabbing some database entries, creating a 2D array and then passing them to
I'm grabbing some information from a database and the record is in an MSSQL
I have a JS/PHP piece of code that selects from a database, does some
I'm grabbing a datetime from a MySQL database using php. In mysql the datetime
I am using Spring 3 and grabbing users from a MySQL database. Right now,
Grabbing delimited dates from database and adding new ones to the list, then want
I'm grabbing a list of events from a database and am trying to associate
I have a datalist that receives values from a MySQL database. This datalist can
I have a problem that annoys me pretty much. I'm grabbing some content from
Ok here is the situation (using PHP/MySQL) you are getting results from a large

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.