It means you have an error in your SQL syntax near the quoted part. Not sure how else to put it. Perhaps in more straight forward terms: You have buggered code. It's kaputt, not working. Bad Query.
Simply use mysql_error function while debugging your applications: http://www.php.net/manual/en/function.mysql-error.php
my best guess is you are giving a string in your WHERE tag where the field is an Integer in mysql fk_user_id='1''
You just showed us the default query in phpmyadmin. What is it you are trying to do? If you just want to show all user details just use select * from user_details Code (markup):
aRo had it right, fk_user_id is a number field, but your SQL query is requesting text (the ' around the 1 tell SQL to treat it as text). Just remove the single quotes from your query and it should work.
I think you have missed the "FIELD" name in the query you showed. $q="SELECT * FROM `user_details` WHERE fk_user_id='1'"; should be the query. Bye
No, it should be: SELECT * FROM user_details WHERE fk_user_id=1; You need something to compare after the WHERE, in this case the fk_user_id field. Wanna bet?
Yes, that should be the query. Additionally, I think instead of fk_user_id, your script must be selecting from some other field like state or country etc. Because if you use fk_user_id, you will keep selecting only the very first record all the time. SELECTING from some other field will give you more records and probably that's what your script must do. Bye
SELECT * FROM user_details WHERE fk_user_id=1; SELECT * FROM user_details WHERE fk_user_id='1'; SELECT * FROM user_details WHERE 1; SELECT * FROM user_details WHERE 1=1; SELECT * FROM user_details; All those queries work.
I go to phpmyadmin then i selected user detail then i selected fk_user_id and paste this in and click go right?
Actually you could just click where it says SQL after you've selected your database, then paste it in the box and click "GO". Also check the SQL tutorials at W3 schools. www .w3schools .com