mysqli_result Object ()

4

I spent the last 3 hours trying to find the error ... maybe it is sleep, but I will put my script very complicated so someone gives me a light.

$query_passaporte = "SELECT num_compra, data_compra, plano, passaporte_paypal FROM paypal WHERE 'empid' = ' ".$_SESSION['empid']." ' AND 'show' ='1' ORDER BY num_compra ASC";

$dados_passaporte = mysqli_query($dbc, $query_passaporte) or die(mysqli_error($dbc));

while(list($num_compra, $data_compra, $plano, $passaporte_paypal) = mysqli_fetch_array($dados_passaporte)){

    echo 'nao funciona'.$num_compra. $data_compra. $plano. $passaporte_paypal;} 

    print_r($dados_passaporte); ------> resulta em mysqli_result Object ()  

that is, it does not return ECHO.

$ dbc is OK. In the query, I use single quotes in EMPID and SHOW to not give syntax error (I do not know why it gives error, other scripts are without quotes)

It was the first code written after I formatted my windows and put UBUNTU (although I'm sure it has nothing to do with it).

I just do not know what I'm missing ...

    
asked by anonymous 13.08.2014 / 19:13

1 answer

4

Do not use single quotation marks ' in field names only for values, if you have a special character name or reserved word use the ' ("show" is a mysql reserved word ).

Your query should look like this:

$query_passaporte = "SELECT num_compra, data_compra, plano, passaporte_paypal
FROM paypal WHERE empid = ' ".$_SESSION['empid']." ' 
AND 'show' ='1' ORDER BY num_compra ASC";

I recommend using prepared staments to avoid problems with sql injection.

    
13.08.2014 / 19:30