Get Username and put in a Mysql query

Ask all your questions about the script here.
andreaem
New
Posts: 4
Joined: Mon Sep 14, 2015 2:41 am

Get Username and put in a Mysql query

Postby andreaem » Fri Sep 25, 2015 4:08 am

Hi guys, i got a problem when try to retrieve username and put in a query.
Maybe isn't a qls problem.
I've tried to put the username in cookies and retrive for the query

Code: Select all

   setcookie("username", $qls->user_info['username'], time()+3600);


Code: Select all

 
    define('QUADODO_IN_SYSTEM', true);
    require_once('auth/includes/header.php');
       
        try {
    $db = new PDO("mysql:host=127.0.0.1;dbname=c9", "xxxx", "");
 
    $username = $_COOKIE['username'];
   
    $username = htmlspecialchars($username);
 
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 
    $sql = "SELECT * FROM data_tasks WHERE data_tasks . user =  '$username' && `progress` !=  '100' ";
    $result = $db->query($sql);


I don't know where the problem is, but even if the cookie is stored and i can read the name in DOM explorer, in PHP i got a NULL value or string(0).

Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest