i'm running an app on facebook but there seems to be a problem with getting data from a table, the table has data in it that is added in the index page, and i need to access it elsewhere, problem is, the query doesn't work, here it is, i'm opening the table to see if the user exists, if the user doesn't, then i add them later on:
$querya="SELECT * FROM user_info WHERE user_info.fb_id='$fb_id'";
//add user to table, as they don't exist
what could possibly be the problem with the above? the userdata['id'] does have data, i printed it out and it displayed the user's facebook id, so why isn't anything happening? thanks in advance.
My guess is that you are using an INT column as opposed to a BIGINT or VARCHAR. Facebook IDs are too long to fit into a traditional 32-bit INT column. If you change your table structure to use BIGINT or VARCHAR (and make sure you index the column if you're going to do lookups like this), you should be good.
The error is the query syntax, using vars inside a single quote returns the variable as a string rather than a variable The query should be:
$querya="SELECT * FROM user_info WHERE user_info.fb_id='".$fb_id."'";