PHP& MySQL Video Playlist (JW Player)

OK.

Yeah, remember that we put the playlists manually in the DB… and that’s how we are getting the videos so far. So, I suppose the video_albums (playlist table) will be populated from the videos pages… eventually.

Yes, the video admin is just for adding videos to out maters list.

The album/playlist admin is for picking videos to create a playlist.
(This could be to select a group of Christmas videos to create a special Christmas playlist, etc…)

And, I just tested the cold on the live site and it is still working, so I will grab it back and send you the important parts… I couple minutes…

Wow, try this, change the LastUpdated field to be TEXT not data.

This field is updated into a format that includes BOTH date and time put into string format.

You are updating a string into a “date” format. Not sure, but, that might be an issue.

OK, let me check…

No luck!

Well, searching my code that works, everything looks the same.
Let’s try one more thing, I have to versions of this code up now and one is working and one is not.
The one that is not has the ID field with autoincrement. I think THAT is the issue.
SO, just delete that col for now in the database and I will figure that out later.

Then, try the videoadmin page again and see if it updates…

Got it!, and Fixed it!!!

This was the baby: timeUpdated) = ‘" . date(‘g:i:s’) . "’"; … extra closing parenthesis ',

 changed it to:  [b]timeUpdated [/b]= '" . date('g:i:s') . "'";

I feel very good now. Tomorrow we will have to add the other fields of the table to be populated as well.

I am dead tired…Crashing right now… [size=18pt]Great team work![/size]

Oh, crap! @#$! I really hate those kinds of errors… Good. Now we can continue…

Is the video page updating as it should now? Also, did you add all of your extra fields on your form?
Once it is completely working, let me know and we will start the next section…

The playlistADMIN section will be similar except the building of the playlist itself.
You will have the same list of videos in the exact same dropdown, so just copy the page.
Then, instead of all of the video info that you are adding now, you will have three items,
a playlist name, a playlist description and lastly, a video list which will be added as you click on videos.
The DELETE VIDEO button will change to DELETE VIDEO FROM PLAYLIST. Etc…

Let me know if you can create new videos names now. We still have to add the actual upload of the videos, upload of thumbnails, etc… I have to get to bed soon, it is almost 2 AM and I’m up at 7 AM… YIKES! LOL

ALll good for now. I will those extra field tomorrow. I assume I don’t have to touch the Javascript, right?

Also, we need to update drop down list code in the videos page, so it affects the player when a different album is selected… just a note before we forget.

I’m DONE for the night… My brain can’t take it… my hands can’t take it… my body can’t take it. Get some nice 5 hours of sleep… we’ll continue tomorrow. I will start updating the code when I wake up.

AND did you notice? We both have been upgraded to senior members at PHPhelp.com for posting so many messages: 109 replies and counting… LOL, THAT’S GREAT! now I am starting to feel like a real programmer… LOL!

Have a GREAT sleep!

To upload pictures, you will have to add a picture to the videoADMIN page,
(We are working on that one now, LOL) and add a browse button inside the current form,
here is some code for that:
[php]

Press ‘Browse’ to locate the picture, then, Submit to update it:




[/php]
Or something like that. When you press submit, a “browse” dialog pops up. Steer to your picture and select it. Then, we need upload code in the VideoADMINupdate.php file to handle the actual picture:
[php]
// Get correct file name to upload

$file_name = $_POST[“UploadPicture”];

$target_path = “Images/” . $file_name;

$picture = $_FILES[‘ufile’][‘tmp_name’];

list($width, $height, $type, $attr) = getimagesize($picture); //this gets data from picture if needed

copy($_FILES[“ufile”][“tmp_name”], $target_path);

[/php]

I can’t believe you have us working on that already LOL.

How about the videos thumbnails that show up in the player… how do we handle that?

last post tonight, pal… I’m beat!

For the Playlist, add a multi-row textarea and when you click the the video list, as we now have it, instead of loading the name and description of the video, it will store the name of the video inside the new textarea. This will become the playlist/album later on. Add a button below it saying “Create This Album” which will post to the VideoADMINupdate.php and in that routine, it will build the playlist from the new textarea.

All of a sudden I feel good about finishing up this project. I’m very sorry I didn’t catch that extra ) !!!

Good night…

Talk to you in the AM… I’m in pain… I am dealing with a bad case of carpal tunnel syndrome, and today I pushed my limits.

I’ll read all of that in the morning to see if it makes some same to me… because as of now I am braind dead :slight_smile:

Good night!

Up and Running! :slight_smile:

I liked how we tackled a problem together last night. You asked me to change the lastUpdated DB field structure to text and not date. Then I went on to take a second look at my timeUpdated DB field and that’s when I also looked at the php code and noticed the extra parenthesis… One thing lead to another!

In the end, it turns out, and after all, that I don’t need the timeUpdated field since time is already included in your lastUpdated field. I did not realized that becase it wasn’t working and could not see it. I will delete timeUpdated.

I know you didn’t have the date/time in your code, but, it is so useful, I add it most of the time now.
Whenever you are monitoring a site, you can review the last updated dates and purge old items.
If something is 8 years old, why is it still active??? That kind of thing. For someone else’s site, it is nice to display the timestamp at the bottom when they are updating something.
Like: "This playlist was last updated: " . $timestamp (at the bottom of the update page.)

I think it adds to an update page. Or, maybe not… But, I do have a couple site where they wanted this at the bottom of each page is very small print… “This page was last…” I think it made them update it more often.
Keeping their data up-to-date!

Well, I am sure now you have a ton to get working. Once you have all of your video ADMIN page working so it updates all the data needed for each video and allows for uploading thumbnails and video files, let me know and we will work on the playlist version. Remember to add a DELETE button for clearing bad video files, etc. And, I gave you little in way of error-checking. You will have to add that as you find possible errors…

Sounds like we are on a roll… Read my last few posts closely as a lot of things in there.
Have fun with it…

Funny you should mention tie stamp, as I am right now struggling how to add a lastUpdated time stamp to the form. Actually, I just want to add above the form, as text so it shows last time selected video was updated. I am trying to pull this value from javascript and SQL.

Make it easy on yourself…

You already pull the video data into the select with the special “|” char separating the data, just add the timestamp at the end … . “|” . $timestamp … whatever…

Then, once a video is selected, the and the info is displayed, the select.value for the timestamp is loaded into the array along with name, description, duration, etc… Easy to use that way…

Not quite sure how to execute that. This is what I have but it’s not working:
Javascript
[php][/php]

The on the Loop I have:
[php]print “<OPTION VALUE=’” . $row[1] . “|” . $row[2] ."|" . stripslashes($row[5]) . “’” . $row[6]. “’” . “>” . $row[1] . “\n”; //NOTE: row(1) is videoname row(3) is descriptions field[/php]

ANd FInally, I try to echo the the time:[php]

Last Updated on:<?php echo $row['6']?>[/php]

Change this:

print "<CENTER><OPTION VALUE='" . $row[1] . "|" . $row[2] ."|" . stripslashes($row[5]) . "'" . $row[6]. "'" . ">" . $row[1] . "</OPTION>\n";  //NOTE: row(1) is videoname row(3) is descriptions field

to:

print "<CENTER><OPTION VALUE='" . $row[1] . "|" . $row[2] ."|" . stripslashes($row[5]) . "|" . $row[6]. "'" . ">" . $row[1] . "</OPTION>\n";  //NOTE: row(1) is videoname row(3) is descriptions field

(You put a quote instead of a bar ’ | …)

And, since this is done DYNAMICALLY, you have to do it in Javascript. So, you need an ID to use… Change the =$row[] stuff where you want to display the date to a real field. I will use a

field for example:
Change this:
 <td>Last Updated on:</td><td><?php echo $row['6']?>

TO:

 <td>Last Updated on:</td><DIV ID="lastUpdated"></DIV><td>

In the Javascript part where it moves the data to locations, the first part is the ID of the field you want to move the VALUE to. So in the Javascript part you called it “lastUpdated”, so the DIV must be called that too.

Try that and let me know…

Sponsor our Newsletter | Privacy Policy | Terms of Service