ok, today i was running a script to insert some data into my mysql database, i kept running the script but it just wouldn't insert the data i was entering on my HTML form through my PHP Script. Then I remember that you can actually display MYSQL errors with the mysql_error() fucntion in php.

this was my query how it looked like:

CODE:
$sql = "INSERT INTO my_table(this and,this) values ('$this','$and','$this')";
$result = mysql_query($sql ,$database);


i kept looking at my query to see if there were any errors, but i didn't catch anything wrong.

So i finally had to do something, i put the mysql_error() to display (or show) if there were any errros on my MYSQL query. so i changed the code to this:
CODE:
$sql = "INSERT INTO my_table(this and,this) values ('$this','$and','$this')";
if($result = mysql_query($sql))
   {
      echo "<h1>SUCESS</h1>";
   }
else
   {
      echo "ERROR: ".mysql_error()."<BR>";
   }


so now when i ran my script, i got it to display the error, and this is what it said:
CODE:
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and, thisp at line 3


GOTCHA!! did you see my mistake? if you notice on my $sql after my_table(this i need to put a comma after "this" so this is how my $sql shoule look like:
CODE:
$sql = "INSERT INTO my_table(this,and,this) values ('$this','$and','$this')";
$result = mysql_query($sql ,$database);


After I corrected this, the script was able to insert all the data from my from into mysql database.