A
Anonymous
Guest
Seems like your query is failing. More than likely the table you are accessing doesn't have a field named "index" when you put single quotes around "index" you changed the meaning of the query so it stopped failing but still returned no results.
I will explain why.
Your initial query:
"SELECT * FROM children WHERE index = $kknumber"
Translates to:
Select all fields in the table "children" where the field with name "index" is equal to the value of $kknumber
Your other query
"SELECT * FROM children WHERE 'index' = $kknumber";
Translates to:
Select all fields in the table children when the word 'index' is equal to the value of $kknumber
Your second query doesn't consider any of the table data in the WHERE clause. Since I assume $kknumber is an integer (or float) value it will never be equal to the string of "index" so your query resolves as false and returns 0 rows.
You need to make sure your query works. You should test it in mysql command shell or in PHPMyAdmin to see what the error is.
I will explain why.
Your initial query:
"SELECT * FROM children WHERE index = $kknumber"
Translates to:
Select all fields in the table "children" where the field with name "index" is equal to the value of $kknumber
Your other query
"SELECT * FROM children WHERE 'index' = $kknumber";
Translates to:
Select all fields in the table children when the word 'index' is equal to the value of $kknumber
Your second query doesn't consider any of the table data in the WHERE clause. Since I assume $kknumber is an integer (or float) value it will never be equal to the string of "index" so your query resolves as false and returns 0 rows.
You need to make sure your query works. You should test it in mysql command shell or in PHPMyAdmin to see what the error is.