Jump to content

webdeveloper123

Members
  • Posts

    437
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by webdeveloper123

  1. Sort of. You assign 'x' to last_q, then fetch the results using a while loop (assuming reason being your fetching one record at a time) then test to see if last_q is less than or greater than the question , if it is echo it. Then you assign the question to last_q then echo the choices, and seeing it's in a loop, it prints out all the choices I sort of agree, although I rarely do it. For smaller projects sometimes it's just easier just to go in and out of php. But for larger projects I can understand why people do it I'm actually trying to create a for loop within your code so I can generate some HTML (which I'm going to echo) so each choice is within the div classes in my original post (eg. answerA, answerB etc)
  2. Thanks ginerjm, I got your code working and it does the job! Now all I have to do is fit it into my HTML!
  3. Hi guys, I am making a Quiz using PDO. I've got my HTML/CSS done and I have a div container where the questions are held and the 4 possible choices. Problem is when I try to show the 4 possible answers on the screen (eg for A,B,C,D) I can only get A to display and then A is the same even for B,C,D. So you basically have a question (which displays fine) but A,B,C,D are all the same choices. Here is my code: $sql = "SELECT questions.question, quiz_options.choice FROM questions JOIN quiz_options ON questions.qid = quiz_options.qid;"; $statement = $pdo->query($sql); $questions = $statement->fetchAll(); <?php foreach ($questions as $question) { ?> <div class="quizContent"> <p><?php echo($question["question"]); ?></p> <div class="answerA"> <p><?php echo($question["choice"]); ?></p> </div> <div class="answerB"> <p><?php echo($question["choice"]); ?></p> </div> <div class="answerC"> <p><?php echo($question["choice"]); ?></p> </div> <div class="answerD"> <p><?php echo($question["choice"]); ?></p> </div> </div> <?php } ?> Now this displays every question in the database 4 times, with each time having the same choice answer. I know it's in a loop and that's why it's showing so many times but I've been at this for hours and Can't seem to figure it out. This is as far as I have got. Many thanks
  4. Hey gizmola, No, the pictures are fixed. The filenames won't change and the images won't be replaced with new ones. I thought about that but decided against it. No, I won't be doing that. Thanks for your help
  5. Thanks guys. I think i'll keep the DB as it is. Nice game, I visited the link. There is a lot in your game which I want in mine. Your keeping your answers in the same table but I have multiple choice answers so I have to have a separate table for the answers
  6. Hey guys, Just a quick one. I would like some advice. I am making a quiz in PHP. I have the following db design and the image attribute is inside the questions table. This attribute will hold the file name of an image (e.g movie_poster.jpg). But later on I thought to take out that attribute from that table and have a new entity called pictures and hold the filenames in there. Surely that would be a better idea? If I don't, I don't think it will conform to Normalisation. Here is the ERD: Many thanks
  7. yessssss! I got it to work! Thanks kicken, would never have been able to do that without your help! 😁
  8. I've come up with this: $(document).ready(function(){ var img = $("#triggerplay"); var configObject = { sourceUrl: img.attr("data-videourl"), triggerElement: "#" + img.attr("id"), progressCallback: function() { console.log("Callback Invoked."); } }; var videoBuild = new YoutubeOverlayModule(configObject); }); But when I type: videoBuild.activateDeployment(); Into the console it gives me the error: videoBuild.activateDeployment(); VM72:1 Uncaught ReferenceError: videoBuild is not defined at <anonymous>:1:3 (anonymous) @ VM72:1
  9. I get it, when it tries to create the var image it hasn't encountered the element triggerplay so it won't create it. But if you look at the script above that one, I am basically doing the same thing. Because: $('.popup-youtube').magnificPopup hasn't encountered the class .popup-youtube but the code still works. If I nest the script inside a: $(document).ready(function() will that make it work? Or even a: jQuery(function($){ //Put your code here }); Like you suggested?
  10. hmm I don't know any Jquery and I am a little confused. I followed the steps in the README guide and thought it would work. Are you saying I can't accomplish this task with the steps in the readme guide?
  11. Thanks kicken. Still having problems with it. I got up to step 6 and it's asking to: After writing the code in the way shown above, you've got to deploy it into your web app (otherwise its not going to work). Use the available deployment method as shown below: videoBuild.activateDeployment(); I put it in console and got the following: youtube-overlay.js:70 Error: Youtube overlay requires requestObject with mandatory props which are of string types. at new YtConst (youtube-overlay.js:44:15) at (index):38:18 YtConst @ youtube-overlay.js:70 (anonymous) @ (index):38 /favicon.ico:1 Failed to load resource: the server responded with a status of 404 () new YoutubeOverlayModule youtube-overlay.js:70 Error: Youtube overlay requires a request object argument. at new YtConst (youtube-overlay.js:36:15) at <anonymous>:1:1 YtConst @ youtube-overlay.js:70 (anonymous) @ VM339:1 YtConst {} videoBuild.activateDeployment(); youtube-overlay.js:104 Error: Youtube Overlay Constructor -> Not able to locate the required Trigger-Element. Can you please check id? ---> undefined at cpo.triggerCheck (youtube-overlay.js:96:15) at cpo.createPlayerContainer (youtube-overlay.js:89:11) at cpo.activateDeployment (youtube-overlay.js:77:11) at <anonymous>:1:14 cpo.triggerCheck @ youtube-overlay.js:104 cpo.createPlayerContainer @ youtube-overlay.js:89 cpo.activateDeployment @ youtube-overlay.js:77 (anonymous) @ VM345:1 undefined Here is my code (only showing relevant parts) <script> var img = $("#triggerplay"); var configObject = { sourceUrl: img.attr("data-videourl"), triggerElement: "#" + img.attr("id"), progressCallback: function() { console.log("Callback Invoked."); } }; var videoBuild = new YoutubeOverlayModule(configObject); </script> <a href="https://www.youtube.com/watch?v=Euy4Yu6B3nU" class="popup-youtube"> <img class="hovering" src="images/air_poster.jpg" id="triggerplay" data-videourl="https://www.youtube.com/embed/Euy4Yu6B3nU"/> </a> Thanks
  12. Hi Guys, I have a webpage where there are images of movie posters and when I click that image it loads the trailer from youtube. Thing is, after I click the image, I then have to click play on the youtube video for the video to play. What I wanted was for the video to start playing automatically when the image is clicked. I was searching around and came across this: https://github.com/sricharankrishnan/click-image-play-youtube-video I looked at the demo and it was perfect. I then tried to implement the plugin. So I downloaded the JS file from the plugin-bundle-files folder. Then then guide says to reference the JS files in the script tag, which I did. Then it says to go into Console and type: new YoutubeOverlayModule I kept getting this error: Failed to load resource: the server responded with a status of 404 () new YoutubeOverlayModule VM72:1 Uncaught ReferenceError: YoutubeOverlayModule is not defined at <anonymous>:1:1 (anonymous) @ VM72:1 until I realised there was an updated JS file in the update section. So I used the updated JS file and I stopped getting the above error. But then after I inputted new YoutubeOverlayModule I get a new error: Error: Youtube overlay requires a request object argument. at new YtConst (youtube-overlay.js:36:15) at <anonymous>:1:1 YtConst @ youtube-overlay.js:70 (anonymous) @ VM211:1 YtConst {} So my question is - is this plugin out of date or Am I doing something wrong? Here is my HTML: <!DOCTYPE html> <html> <head> <title>Movie Quiz</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Roboto&family=Oswald"> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/youtube-overlay.css"> <script src="js/mag-popup.js"></script> <script src="js/youtube-overlay.js"></script> <link rel="stylesheet" href="css/magnific-popup.css"> <script> $(document).ready(function() { $('.popup-youtube').magnificPopup({ type: 'iframe' }); }); </script> <style> </style> </head> <body> <header>Movie Quiz</header> <div class="leftContent"> <h2>CREED 3 OUT NOW!</h2> <img src="images/creed3.jpg"> <p><SPAN STYLE="font-family:'Roboto'">When a childhood friend and former boxing prodigy, Damian (Jonathan Majors), resurfaces after serving a long sentence in prison, he is eager to prove that he deserves his shot in the ring.</p></SPAN> <h2>SREAM 6 IN CINEMAS!</h2> <img src="images/scream6.jpg"> <p><SPAN STYLE="font-family:'Roboto'">Following the latest Ghostface killings, the four survivors leave Woodsboro behind and start a fresh chapter.</p></SPAN> </div> <div class="rightContent"> <h2>NEW & UPCOMING MOVIE TRAILERS</h2> <h2><SPAN STYLE="font-family:'Roboto'">AIR</h2></SPAN> <a href="https://www.youtube.com/watch?v=Euy4Yu6B3nU" class="popup-youtube"> <img class="hovering" src="images/air_poster.jpg"> </a> <p><SPAN STYLE="font-family:'Roboto'">From award-winning director Ben Affleck, 'Air' reveals the unbelievable game-changing partnership between a then rookie Michael Jordan and Nike's fledgling basketball division which revolutionized the world of sports and contemporary culture.</p></SPAN> <h2><SPAN STYLE="font-family:'Roboto'">WHAT'S LOVE GOT TO DO WITH IT?</h2></SPAN> <a href="https://www.youtube.com/watch?v=0LqOp2MNwao" class="popup-youtube"> <img class="hovering" src="images/whats_love.jpg"> </a> <p><SPAN STYLE="font-family:'Roboto'">In London, an award-winning film-maker documents her best friend's journey into an assisted marriage in line with his family's Pakistani heritage. In the process, she challenges her own attitude towards relationships.</p></SPAN> </div> <footer> <p><SPAN STYLE="font-family:'Roboto'">Classic Productions</p></SPAN> </footer> </body> </html> Many thanks
  13. Hey gizmola, Yes that's what was 90% of the problem. Thank you. The rest of the problem was that: Didn't contain the iframe functions. So I just used the build tool to generate the JS file and only included iframe. All done now Thanks!
  14. Hi Guys, I am a very basic Javascript programmer & don't really know Jquery and I need some help. I want to create a link (to a youtube video) which when clicked will open it in a new window. Now I found this page on codepen (https://codepen.io/kliedLABS/pen/DWZoww) and it seems to do exactly what I am looking for. Trouble is I am having problems implementing it. Here is my code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> Document </title> <link rel="stylesheet" href="magnific-popup.css"> </head> <body> <script src="jquery.magnific-popup.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script> <script> $(document).ready(function() { $('.popup-youtube').magnificPopup({ type: 'iframe' }); }); </script> <div> <a class="popup-youtube" href="https://www.youtube.com/watch?v=Euy4Yu6B3nU">Air</a> </div> </body> </html> Am I missing something obvious like I haven't called the function? This is a link to the the Magnific site: https://dimsemenov.com/plugins/magnific-popup/ Many thanks
  15. just download a port scanner online, free one, there are loads of good ones, put your local IP range (192.168.0.1 to 192.168.0.255) it will scan your entire LAN and show you how many active IP's there are. Active IP means that there is active device using your LAN. Then you can rule out your IP address being on the LAN, and other legit devices in your home/LAN and narrow it down from there. Then you can see what ports are open on each active IP. It would be a good idea to find out what ports are open on your IP address. You can cross reference them to known trojan horse ports. And if you have Netbios port 138 open, you might want to close it. Tutorials to close Netbios ports are readily available online.
  16. you can go to fiverr.com
  17. Who's work did I copy as my own? I marked as your solution, I never claimed I wrote that code. That's how a forum works. You get stuck, ask a a question and sometimes you get the correct answer.
  18. I will, it's just the learning process. everyone learns at their own pace, and some people get stuck in bad habits
  19. yes you mentioned a few times to me before
  20. <?php $files = glob("images/*.{jpg,png,gif,svg,jpeg,bmp,webp}", GLOB_BRACE); $cnt = count($files); $i = 0; ?> <div class="slideshow-container"> <?php foreach ($files as $filename) { $i++; echo " <div class='mySlides fade'> <div class='numbertext'>$i / $cnt</div> <img src='$filename' style='width:20%;'> </div> "; } ?>
  21. haha clever guy. Thanks, and thanks for the numbertext, I wasn't sure how to do that one!
  22. it's passed to basename in my original code
×
×
  • 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.