Jump to content

Newly bald guy going even balder! :(


daniellambert

Recommended Posts

Hi,

 

I've got some frustration regarding a query im trying to do.

 

I've got a video table that i want to try and get some results out

 

ID

Name

Video

usr_ID

pairent_vid_ID

Deleted

created

Duration

1

Test1

vid1.avi

22

0

N

today

1:32:32

2

Test2

vid2.avi

22

1

N

today

1:32:32

3

Test3

vid3.avi

22

1

N

today

1:32:32

4

Test4

vid4.avi

22

0

N

today

1:32:32

 

so,

 

if im playing video ID2. How do i then find out the next video in line? when i've only selected video 2's detail.

 

it seems like i need to run a few querys?

 

Get parent ID of video 2 > get video 2 position > load next file and play..

 

any help would be lovely :)

Link to comment
Share on other sites

You can't actually predict the next id in a row.  If you wrote added 1 to the current ID, what do you imagine would happen when you reached the last video?  You'll need to prepare your output to determine what (if any) the previous and next items would be.  That all depends on how you're arriving at your current item - so you're going to have to show some code and explain the situation.

Link to comment
Share on other sites

Humm, can you find out where you are in the array? so if i do something like..

 

// this is the code to find the next video

$query = 'SELECT pairent_vid_ID from Video WHERE Video = vid2.avi';

$result = mysql_query($query) or die(mysql_error());

$row_data = mysql_fetch_assoc($result);

 

$query = 'SELECT * FROM Video WHERE pairent_vid_ID = "'.$row_data['pairent_vid_ID'].'";

$result = mysql_query($query) or die(mysql_error());

 

while($row_data = mysql_fetch_assoc($result))

{

      if($row_data['Video'] == "vid2.avi")

              {

                    $row_data = mysql_fetch_assoc($result);

                    return $row_data['Video'];

              }

}

Link to comment
Share on other sites

You're going to have to explain what you're doing and how you're wanting to accomplish it.  There needs to be a logical flow behind your methodology - if there is, I don't understand it. 

[*] What are you doing and how do you want to get there?

[*] What role does the 'parent_id' play?

[*] How are you determining the parent?

 

Programming is problem solving. Please define the problem (what is the application doing, supposed to do) and how your application is supposed to work when finished.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.