Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

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

Recent Profile Visitors

1,837 profile views

webdeveloper123's Achievements

Advanced Member

Advanced Member (4/5)




Community Answers

  1. 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.
  2. I will, it's just the learning process. everyone learns at their own pace, and some people get stuck in bad habits
  3. <?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> "; } ?>
  4. haha clever guy. Thanks, and thanks for the numbertext, I wasn't sure how to do that one!
  5. thanks ginerjm i'll give that a go Sorry mac_gyver I don't know what your getting at. I read about the format specifier on php.net are you saying the %s is clashing with width:100%?
  6. Hi Guys, I am creating an image gallery. I already have working code to select and upload a image into a directory. I have successfully used glob and a foreach loop to display the images from that folder on to a page. I found some code on "W3C How to" which had ready made image gallery with css and JS included. Here is the link: https://www.w3schools.com/howto/howto_js_slideshow.asp What I am trying to do is echo the html in a foreach loop. I am doing ok so far but I can't get an html attribute into my echo code. Here is what I am trying to echo: <div class="mySlides fade"> <div class="numbertext">1 / 3</div> <img src="img1.jpg" style="width:100%"> </div> Here is what I have: $files = glob("images/*.{jpg,png,gif,svg,jpeg,bmp,webp}", GLOB_BRACE); foreach ($files as $filename) { echo '<div class="mySlides fade">'; echo '<div class="numbertext">1 / 3</div>'; printf("<img src='images/%s'/>" , basename($filename)); } The above code does display all images from the folder "images" onto the page so that's fine. Now the printf replaces the <img src="img1.jpg" style="width:100%">; But I can't seem to get the style="width:100%" Into the printf statement. I have been trying for hours, escaping characters, going in and out php etc etc but Can't figure it out Can someone help please?
  7. just get some code on the page, even if it's basic and just build from there
  8. Hi guys, I've got this error: Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in /var/www/vhosts//customer/edit.php:138 Stack trace: #0 /var/www/vhosts/customer/edit.php(138): PDOStatement->execute(Array) #1 {main} thrown in /var/www/vhosts/customer/edit.php on line 138 Now I researched it and apparently its because my $customers array has 11 keys and my update statement has 10 attributes (excluding the WHERE clause) which is the customer ID record I am trying to update. Apparently if they don't match up, there will be an error. Here is my $customers array and my GET statement for the customer id $id = $_GET['user_id'] ?? ''; $customers['customer_id'] = $id; $customers['first_name'] = $_POST['fname']; $customers['last_name'] = $_POST['lname']; $customers['address'] = $_POST['address']; $customers['town'] = $_POST['town']; $customers['county'] = $_POST['county']; $customers['post_code'] = $_POST['postcode']; $customers['birthdate'] = $_POST['birthday']; $customers['email'] = $email = $_POST['email']; $customers['terms'] = (isset($_POST['terms']) and $_POST['terms'] == true) ? true : false; $customers['fav_food'] = $_POST['fav_food'] ?? ''; $valid = in_array($customers['fav_food'] , $food_choice); $errors['fav_food'] = $valid ? '' : 'Must enter a food type'; And here is my sql/pdo: $sql = "UPDATE customer_details SET first_name = :first_name, last_name = :last_name, address = :address, town = :town, county = :county, post_code = :post_code, fav_food = :fav_food, birthdate = :birthdate, email = :email, terms = :terms WHERE customer_id = :id;"; $statement = $pdo->prepare($sql); $statement->execute($customers); This is the line I get the error on: $statement->execute($customers); Many 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.