Any php helpers please

Discussion in 'PHP' started by fubar1010, Sep 29, 2011.

  1. #1
    I am new to php and i am making my first script as a play about and to help me improve.

    Im stuck at a part and cant seem to find any help anywhere.

    I am wanting to have a little script on my site,
    So in my admin panel i can go to add video,
    Then have a form where i paste a youtube url,


    Then that will add that youtube video to my websites page.

    can anyone help me with this please?
     
    Solved! View solution.
    fubar1010, Sep 29, 2011 IP
  2. #2
    You'd have better luck posting specific issues in this forum rather than one so broad :p

    There's a few processes involved in what you're talking about. When the administrator submits a form, you'll probably want to extract the video ID from the url, and store the result in a database. It's probably going to be easier to use mysql than any of the alternatives. Here's a simple example regarding PDO database connectivity in PHP: http://php.tutorialref.com/pdo-mysql-connect-example.html

    You'd then need the page on your site where you want to display the videos, to fetch the IDs from the database and output Youtube's embed code, supplementing the ID with the result from the database. i.e.:

    print '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $result['videoId'] . '" frameborder="0" allowfullscreen></iframe>';
    PHP:
     
    Alex Roxon, Sep 30, 2011 IP
  3. fubar1010

    fubar1010 Active Member

    Messages:
    229
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #3
    After hours n hours of trial and error i finally managed to create this,

    In my admin panel i add only the youtube id http://www.youtube.com/watch?v=f1KdF_EExXE


    Then on my homepage i set it to echo out pretty much as you had put.
    It works great im happy with it,it took hours to figure out n get to work,
    but its 1 more thing i can say i have learnt :)


    Thanks for your reply tho mate :)
     
    fubar1010, Oct 1, 2011 IP
  4. shivgupta0001

    shivgupta0001 Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    learn about how to embedd youtube videos
     
    shivgupta0001, Oct 4, 2011 IP
  5. fubar1010

    fubar1010 Active Member

    Messages:
    229
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #5
    I know how to embed a youtube video,thats easy.

    But its abit more then that what i needed here,
    i needed a script to add them.

    I managed to make it eventually
    This thread can be closed.
     
    fubar1010, Oct 4, 2011 IP