Jump to content

`mysql`.`user` technical problems.


sepoto
 Share

Recommended Posts

 <?phprequire_once('include.securelogin.php'); $tValue = $_POST['username']; $mysqli = new mysqli($ad_host, $ad_user, $ad_password, "mysql"); if ($mysqli->connect_errno) {    printf("Connect failed: %s\n", $mysqli->connect_error);    exit();} $tSQL = "select * from `mysql`.`user` where user = \"" . $tValue . "\""; if ($result = $mysqli->query($tSQL) && $result->num_rows > 0) {    $result->close();    echo("username#matched");}else { } ?>

If I pull $tSQL out of my Netbeans debugger, remove the opening quote and closing quote and run the query I get some results from the table `mysql`.`user`. For some reason nothing is ever returned into the variable $result though. Could this be some kind of permissions problem on the back end of MySQL somewhere? I thought I had a good idea to create some database users with some permissions and query them from `mysql`.`user` with mysqli but it has really not been working out so far. Any suggestions on how to get things working? Thanks!!!

Link to comment
Share on other sites

I verified this again be writing the script again and copy pasting this much easier query. I get rows out of MySQL workbench no problem however MySQLi return nothing into $result. I am really perplexed here...

 <?phprequire_once('include.securelogin.php');$mysqli = new mysqli($ad_host, $ad_user, $ad_password, "mysql");if ($mysqli->connect_errno) {    printf("Connect failed: %s\n", $mysqli->connect_error);    exit();} $tUserName = "root";$tPassword = "**********"; $tSQL = 'select * from `mysql`.`user` where user = "' . $tUserName . '" and password = PASSWORD("' . $tPassword .'")';echo $tSQL; if ( $result = $mysqli->query($tSQL) ) {echo $result->num_rows();    $result->close();} ?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...