Jump to content

diiazopde

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by diiazopde

  1. thanks ,

    justsomeguy

    the variable $data_base_login is defined in loginDataBase .php and i show it in the first post

     

    //app/loginDataBase.php
    try
    {
    $data_base_login = new PDO('mysql:host=localhost;dbname=espacemembre;charset=utf8', 'root','');
    $data_base_login->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    catch(Exception $e)
    {
    die('Erreur : '.$e->getMessage());
    }

  2. thanks for responding , actually i'm trying to implement the MVC desgin patterns , this variables will be bind in a file which exit in the controllers directory

    thank you again

  3. hi i'm trying to create an app with php

    but i have a real problem , i need help , please and thank you

    
    // login.php
    function  check_user_authentication(User $user)//return the user id if exist in data base else return false
        {
            require_once ('../app/models/loginDataBase.php');
            global $data_base_login;
            $request = $data_base_login->prepare('SELECT id FROM membres WHERE password= :password AND email = :email '); ///my problem is in this line
            $request->execute(array(
                'password' => $user->getPassword(),
                'email'=> $user->getEmail()
            ));
            $id_user = $request->fetch();
            $request->closeCursor();
            if ($id_user)
                return $id_user;
            else
                return false;
        }
    
    //app/loginDataBase.php
       try
    {
        $data_base_login = new PDO('mysql:host=localhost;dbname=espacemembre;charset=utf8', 'root','');
        $data_base_login->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    catch(Exception $e)
    {
        die('Erreur : '.$e->getMessage());
    }
    
    

    the error is :Fatal error: Call to a member function prepare() on null in C:\xampp\htdocs\youMvc\app\models\Login.php on line 14

    thanks every one

  4. hi , i tried to change the width and height of the canvas by using the width and height of a <div></div>

     

    <!DOCTYPE html><html><head><style>#blue{ background-color:blue; height:200px; width:200px;}</style></head><body><div id="blue" >vfn</div><br/><canvas id="myCanvas" style="border:1px solid #d3d3d3;">Your browser does not support the HTML5 canvas tag.</canvas><script>var b = document.getElementById("blue");var c = document.getElementById("myCanvas");var ctx = c.getContext("2d");var imgData = ctx.createImageData(b.width,b.height);var i;for (i = 0; i < imgData.data.length; i += 4) { imgData.data[i+0] = 255; imgData.data[i+1] = 0; imgData.data[i+2] = 0; imgData.data[i+3] = 255;}ctx.putImageData(imgData,0,0);</script></body></html>

     

    but it doesnt work , why?? answers please,and thank you

  5. i want the hide and show a block when you clik on an image, using Javascript code, so this is the complete code for this function but it doenst work

     

    <script>

    function hide(){ if(document.getElementById("arrow").src == "arrowup.png"){ document.getElementById("arrow").src = "arrowdown.png"; document.getElementById("box").style.display = "none"; } else { document.getElementById("arrow").src= "arrowup.png"; document.getElementById("box").style.display = "block"; } }

    </script>

     

    <img id="arrow" onclick="hide()" src="arrowdown.png" width="30" height="30"/>

    <div id="box" style="display:none;">

    </div>

     

    please help me!!

  6. hi , i try to write a function that provide to change the image when i click on it:

    <body>

    <script>

    function hide(){ if (document.getElementById("image").src == "arrowup.png"){ document.getElementById("image").src = "arrowdown.png"; } else { document.getElementById("image").src = "arrowup.png"; } }

    </script>

    <img id="image" onclick="hide()" src="arrowdown.png" width="30" height="30"/>

    </body>

     

    but it doesnt work , what is the problem, please????

×
×
  • Create New...