Jump to content

Sunamena

Members
  • Posts

    85
  • Joined

  • Last visited

Posts posted by Sunamena

  1. So you see price, meaning it probably did not read the ID.

    Try the following.
    Reload the page by using control+F5. This reloads your stored Javascript code.

    Then press F12 (Google chrome) and look for errors in the Console.

    Let us know how this worked.

  2. I have a very large background image.

    It should not fill the screen, usually the image is larger than the screen.
    However, the image is displayed from the top left, and the right and bottom parts are left out.

    However, it should be the top right that is left out.
    image.png.57a3799bbebbae5e13aca3081e72236a.png


    How can I achieve this?

     

  3. I failed to find an example of something specific i am looking for.


    This is what i want: 


    <img src="a.jpg" id="1"> <img src="a.jpg" id="2"> <img src="a.jpg" id="3"> 

    <img src="b.jpg" id="dragable-1"> <img src="b.jpg" id="dragable-2"> 

    When a draggable image (as seen in the ID), gets dragged onto another image i want this to happen:

    <a href="mylink.php?draggable=IDDRAGGABLE1&to=IDOFTHEIMMAGEITGOTDROPPEDINTO"></a>


    Can i find any tutorial on this?
    Is this difficult?


    Thanks in advance =D

  4. Thankyou very much for your reply!

    Well, I will stick with PDO then. I managed to find a solution to make it work with PDO (and I am happy with that :) ).

    I did get error messages, but not anymore. I think the problem was on my end (or i was not patient enough). 

    At the top of my document, to keep it organised i check all my input from the post.
    For the password i hash with sha1. Should i adopt using password_hash instead?

  5. Hello everyone :)

    I have a small problem with my code. I will show the most important parts of it and hope you guys can assist me :)

    This is my code:


     

    $sql = "SELECT * FROM brusers WHERE userName = '$userName' AND password = '$wachtwoord'";
                                    
                                    // Vraag alle resultaten op
                                        $stmt = $con -> prepare($sql); 
                        
                                        $deelStap=mysqli_query($con,$sql);

                                        $result=mysqli_fetch_all($deelStap,MYSQLI_NUM);
                                        // of: $result=mysqli_fetch_all($deelStap,MYSQLI_NUM);
                                        print_r($deelStap);



     

    This is the print_r: 

    mysqli_result Object ( [current_field] => 0 [field_count] => 12 [lengths] => [num_rows] => 0 [type] => 0 )


    When i print_r($result) i get an empty array. How do i get $result as an array?
    I am used to using PDO (i like it alot), my PDO code works fine on my localhost:


    -- Connect with databasw with PDO

    $db = new PDO('mysql:host=localhost:3307;dbname=handikrap', 'root', 'usbw');
        $db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    --- code

    $sql = "SELECT userID, userName, type, ban, laatstIngelogd, inlogPogingen FROM users WHERE userName = :userName AND passWord = :wachtwoord";

                    $stmt = $db -> prepare($sql);
                    $stmt -> bindParam(':userName', $userName, PDO::PARAM_INT);
                    $stmt -> bindParam(':wachtwoord', $wachtwoord, PDO::PARAM_INT);
                            
                            
                    $userName = htmlspecialchars($_POST["userName"]);
                    $wachtwoord = htmlspecialchars(sha1($_POST["wachtwoord"]));
                            
                    $stmt -> execute();                        
                            
                    $row = $stmt -> fetch(PDO::FETCH_NUM);



    but seems to not be supported on the webhost of one.com. Or did i do something wrong?
    Should i stick with PDO or move on to mySqli?

    They use MariaDB on one.com.


    Thanks in advance :)

  6. The new code should be MySqli

     

                            $sql="SELECT * FROM nieuws ORDER BY nieuwsID desc";
                            $deelStap=mysqli_query($con,$sql);

                            $result=mysqli_fetch_all($deelStap,MYSQLI_NUM);

                            $numberInResult = count($result);

     

     

     

    But how to fetch one?

  7. Hey all,



    I have created a website on my local host. 
    Now that  i try to upload it, i get many errors.

    Such as this one:
    $result = $stmt -> fetchAll(PDO::FETCH_NUM);
    ERROR: Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetchAll() in /customers/c/5/e/sunamena.be/httpd.www/eldiemus/nieuws.php:290 Stack trace: #0 {main} thrown in /customers/c/5/e/sunamena.be/httpd.www/eldiemus/nieuws.php on line 290

     

     

    And will this still be valid?
    $stmt -> bindParam(':datum', $datum, PDO::PARAM_INT);

     





    I also had to change my connection method from
        $db = new PDO('mysql:host=urlToDatabasel;dbname=DatabaseName', 'DatabaseName', 'NotARealPassword');
       $db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


     

     

     


    to

     $con=mysqli_connect("sunamena.be.mysql", "sunamena_be", "s6X6tyUj", "sunamena_be");

    This is still save to use without the setAttribute?
       

  8. Hello everyone,


    I have an issue with uploading an image, but i can not seem to figure out what might be the problem.
    I am new to adding images.



    I would like to thank you all in advance for your asistance =D


    This is the PHP code: 

    <?php


    require('bestanddatconnecteertmetdatabaseenzo.php');

    // Foto toevoegen


        if (!isset($_POST["uploaden"])) {
            header('Location: ../fout.php');
        }
        else {
            $error = "";
            if (!isset($_POST["titel"])) {
                $error = "Er is geen ingevulde titel.";
            }
            if (!isset($_POST["omschrijving"])) {
                $error = "Er is geen ingevulde omschrijving.";
            }
            if (!isset($_POST["plaats"])) {
                $error = "Er is geen ingevulde plaats.";
            }
            if (!empty($error)) {
                header('Location: ../fout.php');
            }
            else {
                try {


                    $bestandNaam = htmlentities(preg_replace('/[^A-Za-z0-9\-]/', '', $_POST["titel"]));

        // Kijk of deze titel nog niet bestaat
                    $sql = "SELECT count(fotoID) FROM fotos WHERE titel = :checktitel";

                    $stmt = $db -> prepare($sql);
                    $stmt -> bindParam(':checktitel', $checktitel, PDO::PARAM_STR);
                            
                    $checktitel = $bestandNaam;
                            
                    $stmt -> execute();                        
                            
                    $row = $stmt -> fetch(PDO::FETCH_NUM);

                            
                    if ($row[0] > 0){
                        // deze titel is al in gebruik
                        echo "Deze titel bestaat al. Kies een andere.";
                    }


                    else {


    //            AFBEELDING UPLOADEN

                    


                    $target_dir = "../../images/galerij/";
                    $target_file = $target_dir . $bestandNaam . ".jpg";
                    $check_target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
                    $uploadOk = 1;
                    $imageFileType = pathinfo($check_target_file,PATHINFO_EXTENSION);
                    echo "<br><br>" . $target_dir . "<br><br>" . $target_file . "<br><br>" . $imageFileType;
                    // Check if image file is a actual image or fake image
                    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
                    if($check !== false) {
                        echo "Bestand is een afbeelding - " . $check["mime"] . ".";
                        $uploadOk = 1;
                    }
                    else {
                        echo "Dit bestand is geen afbeelding.";
                        $uploadOk = 0;
                    }
                // Controleer de bestand grootte maximaal 150 kilobyte
                    if ($_FILES["fileToUpload"]["size"] > 320000) {
                        echo "Sorry, je bestand is te groot. Het bestand mag maximaal 300 kilobyte zijn.";
                        $uploadOk = 0;
                    }
                // Aanvaard enkel .jpg bestanden
                    if($imageFileType != "jpg") {
                        echo "Sorry, we aanvaarden enkel .jpg afbeeldingen." . $imageFileType;
                        $uploadOk = 0;
                    }
                // Controleer of er kan worden geüpload
                    if ($uploadOk == 0) {
                        echo "Sorry, je bestand werd niet geüpload.";
                    }
                // Als alles in orde is, sla dan het bestand op.
                    else {
                        if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
                            echo "Het bestand ". basename( $_FILES["fileToUpload"]["name"]). " is geupload.";
                        }
                        else {
                            echo "Sorry, er is een onvoorziene fout gebeurd.";
                        }
                    }


                    

                    if ($uploadOk == 1) {
                    $sql = "INSERT INTO fotos (titel, omschrijving, plaats, landart, creaties, datum) VALUES (:titel, :omschrijving, :plaats, :landart, :creaties, :datum)";

                    $stmt = $db -> prepare($sql);
                    $stmt -> bindParam(':titel', $titel, PDO::PARAM_STR);
                    $stmt -> bindParam(':omschrijving', $omschrijving, PDO::PARAM_STR);
                    $stmt -> bindParam(':plaats', $plaats, PDO::PARAM_STR);
                    
                    $stmt -> bindParam(':landart', $landart, PDO::PARAM_INT);
                    $stmt -> bindParam(':creaties', $creaties, PDO::PARAM_INT);
                    $stmt -> bindParam(':datum', $datum, PDO::PARAM_INT);

                       $titel = $bestandNaam;
                       $omschrijving = htmlentities($_POST["omschrijving"]);
                       $plaats = htmlentities($_POST["plaats"]);
                   // Landart en/of creaties
                       $landart = 0;
                       $creaties = 0;
                       if ($_POST["category"] == 1) {
                           $landart = 1;                       
                       }
                       if ($_POST["category"] == 2) {
                           $creaties = 1;
                       }
                       if ($_POST["category"] == 0) {
                           $landart = 1;
                           $creaties = 1;
                       }
                       
                       $datum = date("omd");

                       if ($_POST["setdatum"] == 1) {
                           $datum = $_POST["datumJaar"] . $_POST["datumMaand"] . $_POST["datumDag"];
                       }


                       


                      $stmt -> execute(); 


                       echo "Foto toegevoegd.";


                }}}
                catch(PDOException $e) {

                    $e -> getLine() . '<br>'; 
                    echo 'Bestand: ' . $e -> getFile() . '<br>'; 
                    echo 'Foutmelding: ' . $e -> getMessage(); 
                    echo "<br><br><br>Er is een fout opgetreden.";
                            
                }
            }

        }
    ?>




    And this is the form

    <form method="post" action="php/fototoevoegen.php">


                            <div class="formwrapper">
                                <div class="formleft">
                                    Afbeelding (enkel .jpg)
                                </div>

                                <div class="formright">
                                    <input type="file" name="fileToUpload" id="fileToUpload" required>
                                </div>
                            </div>

                            <div class="formwrapper">
                                <div class="formleft">
                                    Titel
                                </div>

                                <div class="formright">
                                    <input type="text" name="titel" required max-length="20" placeholder="Titel van de foto">
                                </div>
                            </div>

                            <div class="formwrapper">
                                <div class="formleft">
                                    Omschrijving
                                </div>

                                <div class="formright">
                                    <input type="text" name="omschrijving" required max-length="100" placeholder="Omscrhijf hier de foto.">
                                </div>
                            </div>

                            <div class="formwrapper">
                                <div class="formleft">
                                    Plaats
                                </div>

                                <div class="formright">
                                    <input type="text" name="plaats" required max-length="20" placeholder="Waar is de foto gemaakt?">
                                </div>
                            </div>

                            <div class="formwrapper">
                                <div class="formleft">
                                    Category
                                </div>

                                <div class="formright">
                                    <input class="radio" type="radio" name="category" value="0" checked> Landart en Creaties<br>
                                    <input class="radio" type="radio" name="category" value="1"> Landart<br>
                                    <input class="radio" type="radio" name="category" value="2"> Creaties<br>
                                </div>
                            </div>


                            <div class="formwrapper">
                                <div class="formleft">
                                    Datum
                                </div>

                                <div class="formright">
                                    <input class="radio" type="radio" name="setdatum" value="0" checked> Vandaag als datum gebruiken<br>
                                    <input class="radio" type="radio" name="setdatum" value="1"> Onderstaande datum gebruiken<br>
                                </div>                            
                            </div>

                            <div class="rowwrapper"><!-- 
                                 --><div class="row33">
                                    Jaar
                                </div><!-- 
                                 --><div class="row33">
                                    Maand
                                </div><!-- 
                                 --><div class="row33">
                                    Dag
                                </div><!-- 
                             --></div>
                             <div class="rowwrapper"><!-- 
                                 --><div class="row33">
                                    <select name="datumJaar">
                                        <?php 

                                        $ditJaar = date("Y");
                                        for ($i = 2010; $i != $ditJaar; $i++) {
                                            ?>
                                                <option value="<?php echo $i; ?>"><?php echo $i;?></option>
                                            <?php
                                        }

                                        ?>

                                    </select>
                                </div><!-- 
                                 --><div class="row33">
                                    <select name="datumMaand">
                                        <option value="01">Januari</option>
                                        <option value="02">Februari</option>
                                        <option value="03">Maart</option>
                                        <option value="04">April</option>
                                        <option value="05">Mei</option>
                                        <option value="06">Juni</option>
                                        <option value="07">Juli</option>
                                        <option value="08">Augustus</option>
                                        <option value="09">September</option>
                                        <option value="10">Oktober</option>
                                        <option value="11">November</option>
                                        <option value="12">December</option>
                                    </select>
                                </div><!-- 
                                 --><div class="row33">
                                    <select name="datumDag">
                                        <option value="01">01</option>
                                        <option value="02">02</option>
                                        <option value="03">03</option>
                                        <option value="04">04</option>
                                        <option value="05">05</option>
                                        <option value="06">06</option>
                                        <option value="07">07</option>
                                        <option value="08">08</option>
                                        <option value="09">09</option>
                                        <option value="10">10</option>
                                        <option value="11">11</option>
                                        <option value="12">12</option>
                                        <option value="13">13</option>
                                        <option value="14">14</option>
                                        <option value="15">15</option>
                                        <option value="16">16</option>
                                        <option value="17">17</option>
                                        <option value="18">18</option>
                                        <option value="19">19</option>
                                        <option value="20">20</option>
                                        <option value="21">21</option>
                                        <option value="22">22</option>
                                        <option value="23">23</option>
                                        <option value="24">24</option>
                                        <option value="25">25</option>
                                        <option value="26">26</option>
                                        <option value="27">27</option>
                                        <option value="28">28</option>
                                        <option value="29">29</option>
                                        <option value="30">30</option>
                                        <option value="31">31</option>
                                    </select>
                                </div><!-- 
                             --></div>


                            <input type="submit" name="uploaden" value="Plaatsen">


                        </form>

  9. Hello everyone.

    The Flexbox design I am currently working on, is working fine as you can see here: http://bronies.be/example/index.html

    But there is an error on the following pages: 
    http://bronies.be/example/contact.php
    It does not cover the full width.

    And even worse here: 
    http://bronies.be/example/404.html
    It does not even show the aside image.


    Disclaimer: This is a work in progress. Only parts of the website have been uploaded in order to ask this question.

    I notice that this happens on pages with little content. But i do not want this to happen, but it does.

    What am I exactly doing wrong?



    Thanks in advance for your assistance!

  10. Your code is fine. It works over here.

    Did you try it in different browsers? I used Chrome.
    Remember, if you ever visited the page, the color will be selected FROM visited, and not from link.


    Delete your cookies, close your browser, or try to type a link to a website your sure you have not yet visited.

  11. As dsonesuk sayd: you have to select them and then assign css to them.

     

    For example i have <td class="dontShow"> on my website. I do not want this cell to be seen. I have two options in CSS.

     

    .dontShow {

       Display: none;

    }

     

     

    Or

     

    .dontShow {

    Visibility: hidden;

    }

     

     

     

    The difference is, that display none will remove it from your webpage and the visibility will just make it not be there, but it will still take up the space as if it did exist.

  12. Strange something:


    It does indeed work like this: 

     

    <head>

     

    ,,,
        <script type="text/javascript">
                function insertText(elemID, text)
                {

                    var elem = document.getElementById(elemID);

                    elem.value += (' ' + text);

                }
            </script>

     

    ...

    </head>



    But i encounter the issues when i do this: 

    <head>
    ...

        <script src="js/mylibrary.js"></script>

    ...
    </head

  13. As soon as i start typing in the textarea and press the image with the onclick command, it stops functioning.


    Both innerHTML and value put the content IN the textarea, but NOT anymore once any action has been preformed inside the textarea (such as deleted or typed something)

  14. This is currently my Function:

     

    function insertText(elemID, text)
          {
            var elem = document.getElementById(elemID);
            elem.innerHTML += text;
          }

     

     

    And this is my onclick: 

     

    onclick="insertText('bericht', 'mytext');"


    What it needs to do is add mytext at the END of the current text in my Textarea.

    This function works, but as soon as i enter something IN the textarea, the function stops working.



    Does anyone here know how to solve this issue?

×
×
  • Create New...