I try get pending friend request by this code:
$flag_friend = flag_get_flag('friend');
$friend_p = flag_friend_get_flags($flag_friend, $user->uid);
but it is return error:
PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined.
#0 /home/server/public_html/includes/database/database.inc(2135): PDOStatement->execute(Array)
#1 /home/server/public_html/includes/database/database.inc(664): DatabaseStatementBase->execute(Array, Array)
#2 /home/server/public_html/includes/database/database.inc(2314): DatabaseConnection->query('SELECT fc.*, ff...', Array, Array)
#3 /home/server/public_html/sites/all/modules/flag_friend/flag_friend.module(151): db_query('SELECT fc.*, ff...', Array)
#4 /home/server/public_html/sites/all/themes/server/template.php(433): flag_friend_get_flags(Object(flag_user), '14')
#5 /home/server/public_html/sites/all/themes/server/page.tpl.php(39): muzol_custom_user_tabs(NULL, Array)
#6 /home/server/public_html/includes/theme.inc(1382): include('/home/muzol/pub...')
#7 /home/server/public_html/includes/theme.inc(1072): theme_render_template('sites/all/theme...', Array)
#8 /home/server/public_html/includes/common.inc(5651): theme('page', Array)
#9 /home/server/public_html/includes/common.inc(5518): drupal_render(Array)
#10 /home/server/public_html/includes/common.inc(2550): drupal_render_page('
Is my code correctly?
Comments
Comment #0.0
ShadowMonster commentedchange server
Comment #1
mwesthof commentedThe issue with the query seems to be in the PDO placeholders, which contain a dot i.e. ":fc.fid" .
According to PHP SQL Parser source code, PDO placeholders may consist of
BINDCHR = [:][a-zA-Z0-9_]+;See http://lxr.php.net/xref/PHP_5_3/ext/pdo/pdo_sql_parser.re#49
Besides that, it doesn't look like the function is really used. Couldn't find a direct call from the module code.
Also... after getting the query to run, the next error is on
foreach ($result as $new_flag) {, where$resultshould be$resultS.So a quick fix could be:
Added the patch for those interested...
Comment #1.0
mwesthof commentedother changing