$ClassName=mysql_real_escape_string($_POST["ClassName"], $con);

$query="SELECT ClassID FROM Class WHERE Name='".$ClassName."' ";

its not working..any help...please............!!!!!!!!!

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

6 Years
Discussion Span
Last Post by Sorcher

i have used thz too

$q = mysql_query($query, $con) or die(mysql_error());

its still not working still ((

Edited by Nick Evan: Added CODE tags (again). And enough with the script-kiddie language already.


when i used this it works

$query="SELECT * FROM Class WHERE Name='".$ClassName."' ";

can u tel me a good tutorial of implementing ajax with php?

Edited by Nick Evan: Added CODE tags


Every time you use JavaScript to pass information to a PHP page you need to make sure to encode the strings. And also to add slashes before sending to Database.

Normally the problem relies in JavaScript handling string information. If the string includes and &(ampersand) will break the string into two different variables. The same if the string has quotes or single quotes.

If you're not receiving and error from the mysql_error() then the problem is in the JavaScript not the PHP.


i want the code of passing form elements with post in php with ajax..
i am trying a number of codes,but all in vain:(
can anyone send me please, full code

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.