Hello i am trying to make a simple ajax database search like it explain Here http://www.w3schools.com/php/php_ajax_database.asp
But when i am trying to display records it pops that i have an error on my query line which is this:
Code:
"SELECT * FROM products WHERE productid = '".$q."'"
The 'q' is the user option.
Did i use an invalid format or what?
Soz i am new in programming
Actually, when yo do the query, you don't actually have to do "SELECT * FROM table WHERE column='" . $request . "'". You can do "SELECT * FROM table WHERE column='$request'"..... I'm new here, but I know a lot of languages! Ask me for help sometime!
You should run $q through the mysql_real_escape_string function before using it in the select statement. Otherwise you leave yourself wide open to a SQL Injection attack.
No, Prolog is a weird language. No such thing as return or break. The answer is: You don't. But you don't need to, if you wrote the code right. <grin/>
*******
Postscript: I admit to using Babelfish to do that translation simply because I didn't want to hunt and peck the Cyrillic characters.
If I'd written it myself I would have said Что должно делать если у вас слон в кармане?
And Babelfish translates that as "What must make if in you elephant in the pocket?"
Which tells me that Babelfish doesn't understand idiomatic language. My Russian is rusty, but I think "у вас" clearly means "you have" in normal speech.
Ahhh...interesting. If you reverse the condition (which probably is more common speech) to "если у вас слон в кармане, Что делать ?" then Babelfish comes up with "if you have elephant in the pocket, what to make?" which I'd accept as close enough. Fun stuff!
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Last edited by Old Pedant; 04-15-2011 at 01:10 AM..