Jump to content

"query was empty"


bashkimi

Recommended Posts

HI every1

 

i am a new guy in mysql-php. this 4 lines are making big problem to my web application

 

$a = $_GET['id'];

$servisoi = trim($_GET['servisoi']);

$tekst = " Update klientet set servisoi='$servisoi' where id=$a ";

// echo $tekst;

mysql_query($teskt) or die (mysql_error());

 

they always return the "Query was empty", however if i uncomment the fourth line it prints a very good sql query text.

any help ?

Link to comment
https://forums.phpfreaks.com/topic/67554-query-was-empty/
Share on other sites

No need for quotes if id is numeric. Your problem is far from being fatal lol, as u have misstyped the variable:

 

mysql_query($teskt) or die (mysql_error());

 

shouldnt it be $tekst ??

 

Also consider using mysql_real_escape_string() for sanitizing input and protecting from sql injections:

 

$a = mysql_real_escape_string($_GET['id']);

 

PS: Ckemi shqiptar?!  :D

Link to comment
https://forums.phpfreaks.com/topic/67554-query-was-empty/#findComment-339646
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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