-1

I'm working on an application but what i want to do is get the user likes and store it in my database

But when i try to save it in the database it won't insert it in my database

$likes = $facebook->api('/me/likes');

$fblikes = '';

foreach($likes['data'] as $like){

    $fblikes .= $like['name'].', ';

}

$insert = "INSERT INTO users (name, email, gender, liked)
                VALUES (
                '$fbname',
                '$fbemail',
                '$fbgender',
                '$fblikes'
                )";

$add_bericht = mysql_query($insert);

But whenever i remove $fblikes from the insert sql it will insert into my database

Any idea's ?

Jeffrey Lang
  • 192
  • 1
  • 4
  • 10

1 Answers1

2

I think there is an escaping problem in your query. You are (Very) susceptible to SQL Injection.
See this post on how to prevent it: How can I prevent SQL injection in PHP?

Community
  • 1
  • 1
Dennis Haarbrink
  • 3,738
  • 1
  • 27
  • 54