Jump to content

WARNING: Empty Query


Bluemercury

Recommended Posts

Hi! im having the strangest behaviour regarding mysql+php,i have this script that decides what should be displayed in the screen:

 

$id=$_SESSION["id"];

 

 

  if($remoproc==2)

  {

 

  $query3= "SELECT * FROM acede where id_util='$id'";  //ANY query here without any foundings will result in the warning empty

 

query

 

  $result=$bd->verificaSelects($conn,$query3);

 

  if($result)

for($i=0;$i<mysqli_num_rows($result);$i++) {

$row=mysqli_fetch_array($result);

$id_doc[$i]=$row["did"];

}

 

$query='';

for($i=1; $i<=sizeof($id_doc); $i++){

 

  $a=$i-1;

  if($i==sizeof($id_doc))

  $query .= "SELECT * FROM informacao_documento WHERE  did='$id_doc[$a]' $condicao ";

  else

  $query .= "SELECT * FROM informacao_documento WHERE  did='$id_doc[$a]' $condicao Union ";

  }

 

 

  $result=$bd->verificaSelects($conn,$query);

  }elseif($remoproc==1)

  {

  ?> <form name="form1" method="post" action="remove.php"><?

 

  $query2= "SELECT * FROM informacao_documento WHERE id_ut='$id'"; //HERE the queries will work fine even if they dont find anything

 

  $result=$bd->verificaSelects($conn,$query2);

  }

 

 

This is the function of the database class that handles the queries:

 

 

  //funcao que trata das procuras na base de dados relativamente a integridade da query

 

  function verificaSelects($treta,$querie)

  {

  //executa query e verifica se nao dá erro 

  echo $querie;

  $resultado = mysqli_query($treta,$querie); //or die('Erro, querie para procura falhou');  //ITS here where the warning is caused

 

  // echo $resultado;  

  //Verificar se deu resultado diferente de zero

  //alterar para nao parar aplicacao

if(mysqli_num_rows($resultado) == 0){

$test=mysqli_num_rows($resultado);

echo "esta vazio $test";

}

///echo "Base dados está vazia!"; 

    else {

return $resultado;

          }

 

I just find strange that the same querie can result in the Warning: mysqli_query() [function.mysqli-query]: Empty query warning in one place and not in the other.....

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.