FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » MYSQL PHP Query Not Working
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
MYSQL PHP Query Not Working [message #185483] Thu, 03 April 2014 15:46 Go to previous message
cuteywithlove is currently offline  cuteywithlove
Messages: 2
Registered: April 2014
Karma:
Junior Member
I've spent hours on this and can't understand why this doesn't work.


//////////////////// CODE

$email = strtolower(filter_input(INPUT_GET, 'email', FILTER_SANITIZE_EMAIL));
$blog_id = filter_input(INPUT_GET, 'blogId', FILTER_SANITIZE_NUMBER_INT);
$password = md5(filter_input(INPUT_GET, 'password', FILTER_SANITIZE_SPECIAL_CHARS));

$id = authenticate($email, $password, $db1);


if ($id != false) {

if (!$stmt = $db1->prepare('DELETE FROM blogs WHERE userId=? && blogId=?')) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}


// $id, $blog_Id checked here and are correct!

if (!$stmt->bind_param("ii", $id, $blog_Id)) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}


if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}else{
echo('{"status":"deleted"}');
}

$stmt->close();

}else{
echo('[{"status":"failed"}]');
}


/// COOOOOOOOOOODE END


{"status":"deleted"} is outputted but the record is not deleted.

If I copy and paste the query into phpmyadmin and run it with the values hard coded it works.

No errors are returned.

The user has privileges to delete and everything else.

Is there anyway I can check it? or see any errors any other way?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Strange but true! Working with interfaces in PHP
Next Topic: PDF extract text
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 22:22:43 GMT 2024

Total time taken to generate the page: 0.04245 seconds