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

The Archive Base Latest Questions

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

I’ve got a problem with my audio player ( http://www.vegapohl.com/audio ). I’m trying to

  • 0

I’ve got a problem with my audio player (http://www.vegapohl.com/audio). I’m trying to have the player play a random track from a mysql database, but I don’t want it to play a previous song. Only once all songs have been listened to or skipped, it should “reset” and play all tracks again.

Here is my PHP:

<?php
mysql_connect("localhost", "db57276_11", "*****")or die("cannot connect"); 
mysql_select_db(db57276_11)or die("cannot select DB");


$sql = "SELECT * FROM audio ORDER BY RAND()";
$result = mysql_query($sql);
if (false === $result) {
    echo mysql_error();
}
$row = mysql_fetch_row($result);
$url = $row[0];
$title = $row[1];
$artist = $row[2];
$albumart = $row[3];
?>

I found some answers to similar questions on stackoverflow, but none of them worked for me. To give you a better idea of the general functionality, here is the body markup:

<body>
<script type="text/javascript">
function playPause(soundId,getImg) {
setTimeout(swapImg,30000,getImg);
soundId.volume=.5;
 if (soundId.paused){
     soundId.play();       
 getImg.src='pause.png';


}
   else {
       soundId.pause();
        getImg.src='play.png';
   }

}

function swapImg(getImg){
getImg.src='play.png';
}
</script>
<div class="wrapper">
<div class="wrapmiddle">
    <div class="middle">

        <div class="track">
            <h1><?php echo $title; ?></h1>
            <h2><?php echo $artist; ?></h2>
            <div id="buttons">
<a href="javascript:window.location.reload()" class="next">Skip</a>
<a href="#"class="like">Share</a><a href="#" class="view">Visit Site</a>
</div>
</div>
</div>
</div>

<div class="left">
<div>
    <audio id="track1" onended = "window.location.reload()">
    <source src="<?php echo $url; ?>" type="audio/mp3"></source>
    Your browser does not support this content.</audio>
    <a href="#" onClick="playPause(track1,playImg1);">
<img alt="" class="playImg"    src="play.png" style="cursor: pointer;" name="playImg1" />   
</a><br />
</div>
</div>
  <div class="right">
  <div class="overlay"><img src="icon.png" width="35" height="34" /> </div>
</div>
</div>
</body>

Maybe someone knows of a better way of playing the next track (instead of refreshing the page/iframe). If it could play each track in the table in order and then start from the top again that would also work. Hope someone can help me with this.

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

    Add an additional smallint field to your SQL table, something like status. In that store a 1 or 0 (or something else you devise) to mean unplayed/unskipped, or played/skipped. In your SQL query, add a where clause along the lines of SELECT songname,artist,filelocation,status FROM audio WHERE status=0 ORDER BY rand()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I have a view passing on information from a database: def serve_article(request, id): served_article
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.