0

i'm trying to execute this query and i can't figure it out why it doesnt work, it returns:

Fatal error: Cannot pass parameter 2 by reference

but i only have 1 parameter.

this is the code:

$GLOBALS['mysqli']->query("use ".$db."");
$stmt = $GLOBALS['mysqli']->prepare("SELECT * FROM item_template WHERE name LIKE ?");
$stmt->bind_param("s","'glyph of%'");
$stmt->execute();
$result = $stmt->get_result();

Thanks all in advance.

EchO
  • 1,274
  • 1
  • 10
  • 17
  • I can't be sure, but with grids, where your parameter name is different, it thinks you are trying to pass "another". I see bind_param refers to "s" - could it or should it be "name". Please - just a suggestion - if I got it totally wrong. – Anthony Horne May 17 '14 at 19:09
  • thanks for the answer, the parameter should be a string that's why the "s", maybe i'm getting it wrong. should i remove the "s"? – EchO May 17 '14 at 19:15
  • Rather disregard my comment. – Anthony Horne May 17 '14 at 19:17
  • possible duplicate of [PHP error: "Cannot pass parameter 2 by reference".](http://stackoverflow.com/questions/13105373/php-error-cannot-pass-parameter-2-by-reference) –  May 28 '14 at 02:07

1 Answers1

0

Try this: $stmt->bind_param("s","glyph of%");

user3030212
  • 429
  • 3
  • 4