Jump to content

NLT

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by NLT

  1. NLT

    MySQLI query

    Okay that worked, but is there like a way I could of made that throw a error because no rows were found or would I have to check the amount of rows?
  2. Hey, So recently I decided to try learn MySQLi but I can't find any in depth guides or tutorials so I'm pretty much trying things out for myself. I'm having trouble with a simple query and I'm not sure why, it doesn't throw errors (even when I had an error in the query, I had to manually use $mysqli->error) Here is the code: <?PHP error_reporting(E_ALL); $mysqli = new mysqli(); // removed data if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $preparation = $mysqli->prepare("SELECT `username`,`password` FROM `users` WHERE `email` = ? "); $username="test"; $preparation->bind_param('s', $username); $Rusername = ""; $password = ""; $preparation->execute(); $preparation->bind_result($Rusername, $password); while($preparation->fetch()) { echo $Rusername . "<br>" . $password . "<br><br>"; } $preparation->close(); ?> Question 2: Can I make it display any sort of error throughout any part of the code?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.