Jump to content

webdeveloper123

Members
  • Posts

    437
  • Joined

  • Last visited

  • Days Won

    1

webdeveloper123 last won the day on March 29 2023

webdeveloper123 had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    London
  • Interests
    gym, eating healthy, coding, playstation 4 efootball 2023, going out, cinema/movies, nice restaurants

Recent Profile Visitors

4,480 profile views

webdeveloper123's Achievements

Advanced Member

Advanced Member (4/5)

4

Reputation

1

Community Answers

  1. I don't have img tags. Well I have one, But that's just a fall back option if the other 2 don't load. I only put it in there because they guy who wrote the css and html5 book I bought strongly recommended that this img tag is not omitted So what am I supposed to do, repleace source with img tags? Is that even valid code? Thanks
  2. Hi Guys, Got a bit of a problem here. I'm building a website for a fictional restaurant so I can practice my RWD. All is going well apart from now I want to choose which image to display on different screen sizes. At the beginning I had this code: <div class="col-3 hide-border"> <a href="history.html"><img class="copa" src="images/outside-copa.webp"></a> <div class="content"> <h1>Our History</h1> </div> </div> With this styling: .copa { width: 100%; height: auto; } All was fine on both devices, apart from on the mobile the image looked a bit small. On the desktop it looked great. So I photo edited the same image, but scaled it to a size where it would look better on the mobile. So after that I had to use picture element to choose which image to display. Here is the code: <picture> <source class="copa" media="(max-width: 450px)" srcset="images/outside-copa-edit.webp"> <source class="copa" media="(min-width: 768px)" srcset="images/outside-copa.webp"> <img src="images/manutd.webp"> </picture> It seems to work, but it will not pick up the .copa style class from the css file. So I read around and someone said put it on the picture element (even though the source element supports the class attribute.) So I did this: <picture class="copa" > <source media="(max-width: 450px)" srcset="images/outside-copa-edit.webp"> <source media="(min-width: 768px)" srcset="images/outside-copa.webp"> <img src="images/manutd.webp"> </picture> with this styling for .copa : .copa { width: 100%; height: auto; background-color: red; } I did intentionally put background red for development/testing purposes so I know instantly if the style is being picked up. It only picks up the red colour, not the other 2 styling properties. Can someone help please?
  3. Hi Guys, I am writing a script that pulls 200+ domain names from a db table, with the intent on displaying only the .tld extension of each. I have done that part, works fine. The 2nd part: Now with that data, I want to create an array then use array_unique and display only the unique .tld, write some statistics about them (e.g 20% of your domain names are .com) and possibly make a pie chart at the end. I use this: $unique = explode(" ", $tld); To convert the string to the array, but when I print_r the array I get only one element in the array (the very last one in the db table) Array ( [0] => .com.au ) Here is my full code: <?php include 'includes/db.php'; $sql = "SELECT domain_names FROM domains;"; $statement = $pdo->query($sql); $urls = $statement->fetchAll(); $unique = []; foreach($urls as $url){ $tld = strstr($url['domain_names'], '.'); echo "$tld <br> "; } $unique = explode(" ", $tld); echo '<pre>',print_r($unique,1),'</pre>'; echo '<pre>',print_r($urls,1),'</pre>'; ?> Here is the output (sample) of the echo $tld statement: .co.uk .co.uk .co.uk .uk .co.uk .co.uk .uk .co.uk .uk .co.uk .uk .uk .co.uk .uk All the .tld match up with the db data. Here is a sample of the array $urls Array ( [0] => Array ( [domain_names] => camera.co.uk ) [1] => Array ( [domain_names] => garage.co.uk ) [2] => Array ( [domain_names] => buyer.co.uk ) [3] => Array ( [domain_names] => lane.uk ) [4] => Array ( [domain_names] => cctv.co.uk ) [5] => Array ( [domain_names] => track.co.uk ) [6] => Array ( [domain_names] => track.uk ) [7] => Array ( [domain_names] => sonytv.co.uk ) [8] => Array ( [domain_names] => sonytv.uk ) [9] => Array ( [domain_names] => programs.co.uk ) [10] => Array ( [domain_names] => media.uk ) [11] => Array ( [domain_names] => guide.uk ) [12] => Array ( [domain_names] => batteries.co.uk ) [13] => Array ( [domain_names] => batteries.uk ) ) So my question is, how do I get every single .tld extension that's in $tld into the array? Thanks
  4. Update: I got it, its fixed now. Thanks for all your input guys
  5. But as in the original post, my booking table is there, I have different booking_id per seat, even if the seats were purchased together. So, surely, If I Buy 2 tickets right now, the booking_id should be the same. Like in the hotel system, if a user booked 4 rooms at once, the booking_id would be same for all four. I don't have that, I have different booking_id per seat, even if the seats were purchased together. No. I mentioned JS in the initial post, but only the redirect is done in JS, there is no fetch call to the success page. Here is the relevant snippet: setTimeout(() => { updateSelectedSeat(); alert("Seats booked successfully!");window.location.href = "success.php"; }, 500); JS is in the same state as my previous version when you and mac_gyver helped me show seats that are already booked on the cinema seat map. I achieved that, since then the only change to the JS is the line: window.location.href = "success.php"; That's the thing, I don't have that in my database. I have the booking table sample data in my original post, but there is not a single booking_id attached to many seats like there should be. Do I have to go back and change my data model? Or can there be a surgical intervention & put a band aid on it? Because after this success page is done, that's it with this project, its on to the next one. Or shall I just use GET variables into this url: window.location.href = "success.php";
  6. Can I use the table in my original post or Do I have to create a new table?
  7. That is actually the format my code is in (try, catch) But how do I get those attributes on a success page - redirect in php rather than JS and use GET?
  8. Build a confirmation page like "Booking successful" Here are your booking details: Wonka Monday 26th Feb 19.00 Screen 5 Seat Numbers: C-1, C-2, C-3 Price: £24.66
  9. Hi Guys, I am creating a cinema booking system, all is well, just one thing left to do - a booking confirmation after seats are booked. I can get the page redirecting in Javascript and this is not the problem. In my mind I was thinking of getting the last lastInsertId() from the booking table, pass that to the success page, write some sql and be done with it. But my booking table looks like this: booking booking_id seat_id screening_id 57 399 2 58 400 2 59 751 96 60 752 96 So there are multiple lastinsertId Now, I was doing a hotel booking system before, so I just got the last id, which could have 1 or more rooms attached to the id and then I could do my sql for the confirm page. This is different - there can be 1, 2, 3 or more tickets. And as you can see above each record has a booking_id - which makes sense because it identifies a single ticket each time. But how do I go about this confirm page? Do I write some code to pull the latest booked tickets, say someone logs on and books 3 tickets - do I remember that 3 tickets were booked, get there booking_id and go from there? But how would I know how many tickets the user just booked? I could do it by screening_id, but in between the transaction someone else could have booked tickets for the same screening. Any advice/logic would be welcome Thanks
×
×
  • 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.