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