Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7

Thread: SQL question

  1. #1
    Senior Member duck444's Avatar
    Join Date
    Feb 2003
    Location
    east coast
    Posts
    402
    Member #
    751
    Liked
    2 times
    This may be an odd question to some of you so please forgive my ignorance of SQL.

    I am just starting to explore SQL and was wondering, before I do some serious reading on it, would I possibly be able to use it to update embeded videos from Google Video on my site?

    And if yes, would it be any different or easier than just manually updating the videos by hand (copying and pasting them on each page)?

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Yes.

    You could have a table (at bare minimum 2 columns) videoId and url.

    Then you would extract them from your table and output to a webpage.

    Updating wise, either manually (using mysql/phpmyadmin) or create a online online system where you can log in and edit them.

    Pretty simple to do.

  4. #3
    Senior Member duck444's Avatar
    Join Date
    Feb 2003
    Location
    east coast
    Posts
    402
    Member #
    751
    Liked
    2 times
    Quote Originally Posted by bfsog
    Yes.

    You could have a table (at bare minimum 2 columns) videoId and url.

    Then you would extract them from your table and output to a webpage.

    Updating wise, either manually (using mysql/phpmyadmin) or create a online online system where you can log in and edit them.

    Pretty simple to do.
    Say if I have the same videos on multiple pages, could I edit them on the multiple pages all at once from one place like you can do with css?


    Also, What kind of page do I put the table on and how would I "output" it to a webpage?

    If this would require too much detail to explain here, maybe you (or someone) could direct me to a tutorial or something? Either way, I appreciate your reponse. Thanks.

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    For your first point, yes. Lets say they are in a table called 'videos' and a particular row looked like

    id | url
    1 ball.mpg

    Then on any page where you select from that page with an id of 1, will display the video ball.mpg

    For your second point, you need to
    A) connect to a database
    B) Extract the row you wish
    C) Display the video file

    I am not sure how you want to do step C, as embed is deprecated?

    However,
    PHP Code:
    <?php
    <?php

    // connect
    // change the values to match your database

        
    $location "localhost";
        
    $username "prefix_username";
        
    $password "";
        
    $database "prefix_db";
        
    $conn mysql_connect("$location","$username","$password");

         if (
    $conn
            { 
                echo 
    "Could connect MySQL<br />\n";
            }
         else
            {
                echo 
    "error connecting.<br />\n";
            }
        
    mysql_select_db($database,$conn) or die ("Could not open database");

    // Now extract where id = 1

    $res mysql_query("SELECT url FROM videos WHERE id = 1") or die("Error: " mysql_error());
    $url mysql_result($res0);

    echo(
    $url);

    ?>
    That extracts the URL of a row with 1 as the ID.

  6. #5
    Senior Member duck444's Avatar
    Join Date
    Feb 2003
    Location
    east coast
    Posts
    402
    Member #
    751
    Liked
    2 times
    Quote Originally Posted by bfsog
    For your first point, yes. Lets say they are in a table called 'videos' and a particular row looked like

    id | url
    1 ball.mpg

    Then on any page where you select from that page with an id of 1, will display the video ball.mpg

    For your second point, you need to
    A) connect to a database
    B) Extract the row you wish
    C) Display the video file

    I am not sure how you want to do step C, as embed is deprecated?

    However,
    PHP Code:
    <?php
    <?php

    // connect
    // change the values to match your database

        
    $location "localhost";
        
    $username "prefix_username";
        
    $password "";
        
    $database "prefix_db";
        
    $conn mysql_connect("$location","$username","$password");

         if (
    $conn
            { 
                echo 
    "Could connect MySQL<br />\n";
            }
         else
            {
                echo 
    "error connecting.<br />\n";
            }
        
    mysql_select_db($database,$conn) or die ("Could not open database");

    // Now extract where id = 1

    $res mysql_query("SELECT url FROM videos WHERE id = 1") or die("Error: " mysql_error());
    $url mysql_result($res0);

    echo(
    $url);

    ?>
    That extracts the URL of a row with 1 as the ID.

    So the above code would go on the page(s) I wanted the video to appear?

    By deprecated do you mean it prevents the video from displaying totally or merely depreciates the quality?

  7. #6
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Quote Originally Posted by duck444
    So the above code would go on the page(s) I wanted the video to appear?
    Yes, you will have to edit the database variables to match your own setup.
    Also you will need the table created, and filled with data.

    Quote Originally Posted by duck444
    By deprecated do you mean it prevents the video from displaying totally or merely depreciates the quality?
    By deprecated I mean when you validate the page depending on your DOCTYPE you will get validation issues..

    Some XHTML guru may know the tag to use.

  8. #7
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Deprecated code is code that, while probably works, is no longer recommended for usage one way or another. It could be because there's a bug, there's a more efficient way, or a new way that makes the old way obsolete.

    For example, in XHTML, [minicode]<img ... >[/minicode] is deprecated. It still works to display an image, but it is not valid XHTML anymore. The proper method is [minicode]<img ... />[/minicode] as it resembles XML.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:38 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com