0

I am having trouble any time i use bind_param twice in one file.

$stmt = $mysqli->prepare('SELECT url FROM photo WHERE album =?');
$stmt->bind_param('i', $set);
$stmt->execute();
$stmt->bind_result($url);
while ($stmt->fetch()) {
$stmt1 = $mysqli->prepare('DELETE FROM photo WHERE url=?');
$stmt1->bind_param('s', $url);
$stmt1->execute();
unlink($url);
}

I get an error on this line:

$stmt1->bind_param('s', $url);

This is the error:

Fatal error: Call to a member function bind_param() on a non-object in

I have looked all over the place to try find a solution but I haven't so far.

Thanks, Waq

Waq
  • 51
  • 8
  • What is the value of `$set`? – Homberto Aug 31 '14 at 21:51
  • It is a parameter $set = $_GET['set']; EDIT: It is an integer. 1, 2, 3 etc – Waq Aug 31 '14 at 21:54
  • Then it looks like `$mysqli->prepare('DELETE FROM photo WHERE url=?');` is returning false indicating that it is an invalid query. – Homberto Aug 31 '14 at 22:10
  • Thanks for the reply, every time I use bind_param inside a while loop with a fetch() it doesn't work. The statement works on it's own. – Waq Aug 31 '14 at 23:56

0 Answers0