[Solved] Erro function userDelete  

  RSS

JBFelizberto
(@jbfelizberto)
Trusted Member
Joined: 4 months ago
Posts: 28
09/04/2019 4:27 pm  

Hello,

I am trying use the userDelet fuction, but I have a error:

PHP Notice:  Undefined variable: data in C:\.......\traccarApi-1.1.php on line 133

 

It is not define like the other methods. Could you help me?

                            public static function userDelete($sessionId,$id){

                            miss data{}......
                            return self::curl('/api/users/'.$id,'DELETE',$sessionId,$data,array(self::$jsonC));
                            }

JB


Quote
jaimzj
(@jaimzj)
Guru Admin
Joined: 1 year ago
Posts: 48
09/04/2019 4:33 pm  

So, your error is not related to the userDelete() function at all. I have clarified this before as well in the forum.

Your error clearly says its on line 133. 

All the functions has been tested to work with traccar 4.3 version.

You should debug what you are passing to the function and what is the functions reponse. at all times to figure out what the problem is.

The $data variable if not defined in some functions not necessary the api call wont work.

This post was modified 3 months ago by jaimzj

Markers & maps are magical !!!


ReplyQuote
JBFelizberto
(@jbfelizberto)
Trusted Member
Joined: 4 months ago
Posts: 28
09/04/2019 4:40 pm  

sorry, did not understand. I have passed only ID and SessionID

 

$sessionId = gps::$cookie;
$_SESSION['sessionId'] = $sessionId;

$response = $a->response;
$responseCode = $a->responseCode;

 

$USUARIO_ESCOLHIDO = trim(filter_input(INPUT_POST, 'UsuarioEscolhido', FILTER_SANITIZE_STRING));

$id = $USUARIO_ESCOLHIDO;

$d = gps::userDelete($sessionId,$id);
$response_4 = $d->response;
$responseCode_4 = $d->responseCode;
if($responseCode_4 == '200'){
echo "<br><br>Usuario apagado com sucesso...<br><br>";
}
else{
echo "Nao foi possivel apagar o usuario. Favor checar avisar p administrador..... <br><br>";
//echo "Codigo erro: " . $responseCode_4 . "<br><br>";
//echo "Descricao erro: " . $response_4 . "<br><br>";

}

Help me please

 

JB

 

This post was modified 3 months ago by JBFelizberto

ReplyQuote
jaimzj
(@jaimzj)
Guru Admin
Joined: 1 year ago
Posts: 48
09/04/2019 4:43 pm  

Like I said the error you are referring to (variable $data not defined) you keep using that as an error for all problems you face. my suggestion is you should look beyond it always dont be stuck on that.

And show me the response of this part of your code I need to see the output

$response_4 = $d->response;
$responseCode_4 = $d->responseCode;

 

Markers & maps are magical !!!


ReplyQuote
JBFelizberto
(@jbfelizberto)
Trusted Member
Joined: 4 months ago
Posts: 28
09/04/2019 4:53 pm  

I change the code, but still  show only me:

PHP Notice:  Undefined variable: data in C:\ZAZrelatorios\TRACCAR_ADD_USER_via__PHP\traccarApi-1.1.php on line 133

 

 

code:

$d = gps::userDelete($sessionId,$id);
$response_4 = $d->response;
$responseCode_4 = $d->responseCode;
echo "Codigo erro: " . $responseCode_4 . "<br><br>";
echo "Descricao erro: " . $response_4 . "<br><br>";

if($responseCode_4 == '200'){
echo "<br><br>Usuario apagado com sucesso...<br><br>";
}
else{
echo "Nao foi possivel apagar o usuario. Favor checar avisar p administrador..... <br><br>";
//echo "Codigo erro: " . $responseCode_4 . "<br><br>";
//echo "Descricao erro: " . $response_4 . "<br><br>";

}

 


ReplyQuote
JBFelizberto
(@jbfelizberto)
Trusted Member
Joined: 4 months ago
Posts: 28
09/04/2019 4:56 pm  

information additional: although the error message, the user is deleted


ReplyQuote
jaimzj
(@jaimzj)
Guru Admin
Joined: 1 year ago
Posts: 48
09/04/2019 4:57 pm  

Okay I cant' repeat my questions over and over, please re-read my question and share the information I asked you for.

And additionally please stop posting the same error.  you need to disable your PHP error reporting! 

Read my post before this post, and share that response! and in-case you are not getting any response, it means you are doing something wrong!

And please stop re-posting the $data variable not defined error, I have already answered that for you numerous times. 

Markers & maps are magical !!!


ReplyQuote
jaimzj
(@jaimzj)
Guru Admin
Joined: 1 year ago
Posts: 48
09/04/2019 4:59 pm  
Posted by: JBFelizberto

information additional: although the error message, the user is deleted

if you are saying the user is deleted, then you are not reading my messages or responses at all.

I am being clear, i wont repeat it. If you get an error, that is generic to PHP then you need to look up for PHP resources.   

 

Disable your ERROR Display codes in PHP !

Markers & maps are magical !!!


ReplyQuote
Share:
  
Working

Please Login or Register