List database file and put a new row after a certain number

Asked

Viewed 45 times

0

I’ve been trying for days to find a small solution:

Example:

I have this code:

//LISTAR AS PLAYLISTS
$dados_playlist = mysql_fetch_array(mysql_query("SELECT * FROM playlists where codigo = '".$_POST["playlists"]."'"));

The moment she is listed, I need to put 1 command (".$hora."".$minuto.") after a certain number the user chooses.

Example:

Regular list:

1. Música 
2. Música 
3. Música 
4. Música 
5. Música 
6. Música

Now, example of how I need to leave after it is listed:

1. Música 
2. Música 
3. Música 
".$hora."".$minuto."
4. Música 
5. Música 
6. Música 
".$hora."".$minuto."

(in the above case the user selected: perform right time every 3 songs)

After that, I will save this list in a temporary file --> run a cron so that this ".$hora."".$minuto." are spoken in a player

  • How you are generating this list after fetching the database data?

  • Edit your question and include any necessary information.

  • I don’t know how to edit

1 answer

0

$count = 1;
while( $row = mysql_fetch_array(mysql_query("SELECT * FROM playlists where codigo = '".$_POST["playlists"]."'")) )
{
    if( $count == $escolha_usuario1 )
    {
      echo "HORAMINUTO";
    }

    if( $count == $escolha_usuario2 )
    {
      echo "HORAMINUTO";
    }

    if( $count == $escolha_usuario3 )
    {
      echo "HORAMINUTO";
    }

    $count++;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.