PHP& MySQL Video Playlist (JW Player)

I am still not get anything passed to the database. I just noticed your $videoID variable was set different to mine i the DB. I just fixed to reflect that change. But still nothing is happening.

I am not sure if you noticed, but I have eliminate the $dbConnect for the time beign as I am using a connection files as an include (‘connect.php’);

Could you take a second look and the the pages I posted and see if something is missing. As far as I can see, it should be working. Probably the issue lies with the videoID variable. I see it used in the videoAdmin.php form page but nowhere in the videoAdminUPDATE.php page.

I have to move on to some other work for a couple hours…

I will review your code and look at the changes you did. But, it may be in a couple hours as I need to pay the rent now… LOL…

You have the FLV items to review until I get back to you. (You might want to start with the last link I sent to first.)

In awhile…

Sure

One more quick note before I go back to my work.

I was thinking about the video-name issue. If you pull the name from the file itself, you will most likely get something that is not useful. If I make a video with a camera, the internal name will be something like “Created by HP315 cam” or whatever the camera sticks in there. LOL, no, I do not use a 315, whatever
that is… But, the actual filename might be better. It really depends on where you get these video files.

If you get them from your own collection, then, you have already named the files to make sense. If you are getting them from Uploaders on the site, they could be named anything. Of course, if they are from Uploaders, you would have to review them first to make sure someone did not upload a unsavory file. Even a video with someone’s name or address mentioned can be considered unsavory…

So, the name-issue is a bit tricky depending on where you get the videos, how they are converted, etc. If you convert them AVI’s or MPEG’s into FLV’s, you can change the name INSIDE the file when you convert them. Lots of options there to think about.

Review the FLV sites I sent you and strip out whatever you want and play around with the codes for awhile. I will return a little later with help on the Video Page code…

I hear you. The reason I want to get the name from the files is because I will transfer administration to other church members, which less knowledgeable of technical issues. Also, the videos I will be getting will already be named somewhat appropriately. And Remember that, even if the video files named something like hgv[oi5456.mpg, after the files are uploaded, they can always change the file name using the admin area, which I will instruct them.

Now, I gets me thinking that the most important thing is not so much the file name as in $videoName, but the file name location as videoLocation in the DB. I think that is what I was thinking all along, I just made wrong use of wording.

Anyway, I just took a Super Market break because I am starving. Mi wife wrecked my car last week, I just had to walk two miles (1 mile one way) to get some groceries.

I haven’t checked the FLV site but I will take a look after I eat.

Had a quick moment to check in. I think the easiest for your church clients would be to have them simply enter the name of the video. Everything else will be done for them. They will have two sections on one ADMIN page. One to load and edit video names and one to create a playlist from the already entered videos.
It will be very very easy for them. How often will they be adding videos? Not every day, so they can just type in the names. The program will put the uploaded picture to the server in the folder YOU want it in, they don’t even have to care about that… Hope that made sense… I will look at your code in a couple hours…

Yeah, that’s good enough. As long as they don’t to use their brains (LOL), I am OK with that :slight_smile:

Only, and maybe, a few people will be managing the videos and the site as whole. I think, once we have this admin complete, I might modify the code to allow the website users to upload their own (like Youtube) videos and photos, and these will not post right away as they will need to be approved by the administrator. As you know, it is a church website, and I have to make sure random user do not start uploading kinky stuff… you know.

Yes, I agree. You don’t want kinky stuff uploaded to a church website. That is easy to add. Uploading pictures is easy, I have done that several times on sites. Also, you just add a code like “Preview” or whatever and the ADMIN person will see that there is “x” number of uploaded videos to preview and okay. That is easy.

I have just a little more time and I will be able to look back at your other code. A client will be here soon and then I will be free after a very short meeting…

Thanks so much for all your help and insight. Do your thing and take your time. I am anxious, and excited of course, but you have to take care of yourself first.

The good thing is that we are advancing, and hen done, we are going to have a neat finished product that we can use over and over and even keep expanding it. :slight_smile:

A quick once over so far…

Had to tell you, the videos02.php page is NICE! Then that is done with a nice church’y background it will look great! AND … AND… I liked the alternating colors on the dropdown… WHY DIDN’T I THINK OF THAT! Is a very nice touch…

Had to stop looking at your code and tell you that! More soon…

Looks like this is the problem…
[php]
// Update the Video’s data, if it does not exist then insert new version…
$query = “UPDATE videos SET videoName=’$videoName’, videoDescription=’$videoDescription’, lastUpdated=’” . date(‘Y-m-d H:i:s’). “’ WHERE videoName = ‘$videoName’”;
//**************
$query = “UPDATE videos SET videoName=’$videoName’, videoDescription=’$videoDescription’, lastUpdated=’” . date(‘Y-m-d H:i:s’). “’ WHERE videoName = ‘$videoName’”;
//**************
$result = mysql_query ($query) or mysql_error();

[/php]
For some reason, there is two lines of $query=… remove one
and the query is executed wrong. It is using an OR so it is doing a logical OR instead of an “or die” whatever… It should be something like this:
[php]
// Update the Video’s data, if it does not exist then insert new version…
//**************
$query = “UPDATE videos SET videoName=’$videoName’, videoDescription=’$videoDescription’, lastUpdated=’” . date(‘Y-m-d H:i:s’). “’ WHERE videoName = ‘$videoName’”;
//**************
$result = mysql_query ($query, $dbConn);
[/php]
Try these minor changes and let me know what happens…

Sorry I’ve take a while… Having some issues at home. The video page will goge somewhere on the Maranatha.tv site I noticed the two querys and I removed the second one, but it did not help.

Here’s my query so far:

[php]<?PHP
session_start();

//print_r($_POST);
//die();
// Set up database connection…
include(‘connect.php’);

//CRATE SHORT VARIABLE NAMES

$videoID = $_POST[‘videoID’];

$updateVideo = isset($_POST[‘updateVideo’]);
$deleteVideo = isset($_POST[‘deleteVideo’]);
$videoName = mysql_real_escape_string($_POST[‘videoName’]);
$videoDescription = mysql_real_escape_string($_POST[‘videoDescription’]);

// Handle Video Updates…
if(isset($updateVideo)) {
// Update the Video’s data, if it does not exist then insert new version…
$query = “UPDATE videos SET videoName=’$videoName’, videoDescription=’$videoDescription’, lastUpdated=’” . date(‘Y-m-d H:i:s’). “’ WHERE videoName = ‘$videoName’ AND videoID =’$videoID’” ;
//**************

//echo(“QUERY=” . $query); echo(“
records=” . mysql_affected_rows());
if (mysql_affected_rows()==0) {
$query = “INSERT INTO videos SET videoName =’$videoName’, videoDescription = ‘$videoDescription’, lastUpdated= '” . date(‘Y-m-d H:i:s’) . “’,
timeUpdated) = '” . date(‘g:i:s’) . “’”;

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

if(isset($deleteVideo)) {
// Delete the Video…
$query = "DELETE FROM videos WHERE videoName = ‘$videoName’ ";
//$dbConn = mysql_query ($query);
}

//mysql_close($dbConn);
// After update or delete is completed, go back to ADMIN page…
//header(“Location:videoAdmin.php”);

?>

[/php]

I added the videoID variable to the page… don’t you hink we need it? Anyway, without it, the result is the same. I think we need to use mysql_fetch_row() somewhere like we did before.

Also, I deliberately entered junk query and no errors are rendered.

See if you can spot something else.

Did you read my previous post? I found two errors in your code where you run the query. Look back to my previous post and fix those two lines… Let me know if it fixes it…

I changed it to:
[php] // Handle Video Updates…
if(isset($updateVideo)) {
// Update the Video’s data, if it does not exist then insert new version…
$query = “UPDATE videos SET videoName=’$videoName’, videoDescription=’$videoDescription’, lastUpdated=’” . date(‘Y-m-d H:i:s’). "’ WHERE videoName = ‘$videoName’ " ;
$result = mysql_query ($query);
//**************[/php] and still nothing.

Pleas note that I am not using the $conn variable as a connection page is inserted at the top: include(‘connect.php’); I did this to avoid having to insert connection variables in every single page.

In these lines, after the $query = "update…
Add this one;

echo ($query); Die();

Try the page and it will echo your actual query and stop so you can see the query.
Then, you can compare what you typed in with what it sent to the database.
If they match, I will have to play with it some. If they do not match, fix the error.

Oh, if nothing happens, it is not getting to the if(isset($updateVideo)) area…

Let me know if it is the exactly the same. (Look carefully as a quote is hard to see sometimes.)

It actually matches perfectly: [php]UPDATE videos SET videoName=‘video01.flv’, videoDescription=‘VIDEOS/video01.flv’, lastUpdated=‘2012-02-08 03:33:58’ WHERE videoName = ‘video01.flv’ [/php]

And just so you know the date field in the datbase structure is set to date. I telly you this because I initially didn’t have this field… just making sure my set up is ok on my end.

Hey, I am not sure, but, try it again. comment out the echo we just put in, but, keep it handy.
Post it again, but, this time do NOT put a / in the form. It might be that.

Let me know…

where in the form?

The query you sent to me shows the VideoDescription set to Videos/

I think the slash might be doing it…

hummm… this what is actually happening…

When choosing the video Name from the dropdown list, sends the video name to first text box: Correct.
Then in the description box, and actually, a different field from the databse is pulled. This is the videoLocation, which this point I am not using since we are only testing the query.

I will add all the relevant fields Later. Take a look at my videos DB table:

Sponsor our Newsletter | Privacy Policy | Terms of Service