Jump to content

[SOLVED] NEED HELP


semaj4712

Recommended Posts

Let's start from a solid beginning so we can get this answered. First, show me the code you use to insert the video(s) id(s) and related info into your database. I'm assuming you're using a form to add these. Once we determine how you get it in there then we can determine how you can get it out of there.

Link to comment
Share on other sites

um ok...see thats the problem, i know where it ends up in my mysql database but i dont know how it writes it there, because i said this earlier this is a component for my open source that i am trying to edit...

 

ok so this is what i know

 

it asks for the youtube code i put that in that then writes it to the msql database

 

_joom1

 

in that database there is a table called

 

jos_jmovies

 

then in that table their is a field

 

allvideosfonteid

 

that is where the info is

 

now i want to insert that into my code

 

is that enuff info if not i dunno wat else to tell you, i cant locate the exact spot that the info is written to the db

Link to comment
Share on other sites

Looks like you're using Joomla. Is that it?

 

Ok, well... here's the scoop. You can do a query that summons the info from that field but it has to have an 'identifier' in order to do so. Usually that's some sort of unique field like an auto-incrementing 'id' field. So, for every video you enter a 'counter' moves up a notch.

 

If you want to display all videos in a category, for example, then you'd write something like this

 

<?php
$sql = "SELECT * FROM videos WHERE category='Action'";
$results = mysql_query($sql) or die(mysql_error());
$echo "<table width='500' border='0' align='center'>";
while ($row = mysql_fetch_array($results)) {
echo "<tr><td>" . $row['title'] . "</td><td>" . $row['description'] . "</td><td><a href='http://www.yoursite.com/linktovideo.php?video_id=" . $row['video_id'] . " '>View Video</a></td></tr>";
}
echo "</table><br>\n";
?>

 

That would summon all the videos in that category and place them into a table with each video occupying a different row. The example of the URL is what I think you're looking for. You populate it by doing the query, fetching the array, then populating that spot in the URL with the field used for the id.

Link to comment
Share on other sites

Actually you'd put the table name there, not the database name.

 

Database contains tables

tables contain fields

fields contain data

 

When you do a query you select data from fields within tables. You do, however, have to connect to the database. That requires code like this:

 

<?php
$conn = mysql_connect('hostnamehere', 'usernamehere', 'passwordhere') or die(mysql_error());
$db = mysql_select_db('databasenamehere') or die(mysql_error());
?>

 

This should be above the query code and, obviously, you'd replace those parameters with the actual info for your database.

 

For the 'what' where it says 'Action', yes..you'd replace that with the field you want to identify with. That is what the query will pull from in order to produce the results. You don't HAVE to have the 'WHERE' clause in there. You can simply pull all the videos if you wish by deleting it. BUT, if you have hundreds of vids to display then the page would be a mile long. You'd need some pagination to make it work right.

 

 

Link to comment
Share on other sites

If you want to play a specific video then you would need to have a link/url that points to it. Like this:

 

<a href="playvideo.php?video_id=24">Play This Video</a>

 

Now, how you get that id # in there is the trick. First, you must provide a list or something where these people can choose from to watch videos. Is that right? In other words, are you providing some type of selection list that they would click on to view videos? If not, then what does this actually mean:

 

how do i tell it to locate what video id it is on and play that ids code
Link to comment
Share on other sites

I think what i'm getting to is HOW do you determine that you want to show A particular video? In other words, are you just wishing to show a specific video on the page? Or is this something that a visitor would select to see? Do you want a random video to show up on the home page? What we need to determine here is WHY that particular video. And WHAT happens prior to the video being shown. Does someone come to your site, see a button that says Videos, takes them to a page that shows ALL of them? Or just one? Where does this video come into play?

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.