Jump to content

endorush85

New Members
  • Posts

    5
  • Joined

  • Last visited

endorush85's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. aha! I figured it out I had the link wrong in the database. i was using https://www.youtube.com/watch?v=_YZuCdS5_t0 when I should have been using: https://www.youtube.com/embed/_YZuCdS5_t0 I was using the "watch" link like the actual link, I didn't realize you had to swap "watch?v=" with "embed/" problem solved, frikken beautiful, thanks again! hopefully if someone else has this same problem they will find this thread and it will help them Thanks
  2. okay I sort of got it working, thanks to all yall's help... it's finally feeding the variable into the attribute properly, i've confirmed that, however now I have another problem which is probaly outside the scope of php/html etc I get the frame, and inside of it it looks like this: ------------------------------------------------ Firefox Can’t Open This Page To protect your security, www.youtube.com will not allow Firefox to display the page if another site has embedded it. To see this page, you need to open it in a new window. Learn more… ----------------------------------------- when I click on that frame, it will load in a new window on the youtube site, but it won't embed. They must have changed something recently because I used to be able to embed videos like that. I even tried again without the variable, no php, just plain text in the src attribute and it gives the same error... some youtube permissions problem. Well at least the problem I was concerned about has been solved. Thanks again for all your help. I'm pretty good with C# C++ But PHP has been kind of tricky for me so far. Thanks!
  3. heres the code <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <?php $servername = ""; $username = ""; $password = ""; $dbname = ""; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }else { echo "Connection Established."; } $sql = "SELECT url FROM songs"; $result = $conn->query($sql); if ($result->num_rows > 0) { while( $row = $result->fetch_assoc() ) { <iframe width="420" height="315" src=$row['url']></iframe>; } } else { echo "0 results"; } ?> all I get when I try to open in the browser is a blank screen
  4. Thanks for the reply. I tried that code but it still doesn't work. It creates the IFRAME, but its just a black box, no content. When I look at the page source in the browser it says <iframe width="420" height="315" src=""></iframe> it wont transfer the variable. it's the exact problem I've been having and don't know why this does't work it seems so simple, pull a variable from the db, and plug it into the IFRAME src attribute. It's got to be incorrect syntax or maybe scope problem, I'm still working on it, any tips are appreciated.
  5. I can connect to the database, and when I run a simple query, it prints the url on the web page. But what I really want to do is use that url (youtube) and use it as a variable to put inside an <IFRAME> to embed on my site. Heres the code I'm working with: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "N"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }else { echo "Connection Established."; } $sql = "SELECT url FROM songs"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "id: " . $row["url"] ; } } else { echo "0 results"; } ?> this part right here: while($row = $result->fetch_assoc()) { echo . $row["url"] ; } that prints the youtube link..... How could I make this link into a variable to supply as a parameter for this: <iframe width="420" height="315" src="https://www.youtube.com/embed/tgbNymZ7vqY"> // variable goes here </iframe> anybody that could help me make this work I'd greatly appreciate it.
×
×
  • 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.