Why is this PHP code accessing a MySQL database not working? -


<?php  require('database.php'); $user = $_post["username"];     $password = $_post["password"];     $location = $_post["location"];      $stmt = $mysqli->prepare("insert userinfo (username, password, location) values (?, ?, ?)");     if(!$stmt) {         //printf("query prep failed: %s\n", mysqli->error);         echo "query prep failed".$mysqli->error;         exit;     }     $stmt->bind_param('sss', $username, $password, $location);     $stmt->execute();     $stmt->close();     error_log("username ".$user, 3, "/tmp/php_error.log"); }  ?> 

database.php

<?php  $mysqli = new mysqli('localhost', 'php', 'passtheword', 'android');  if($mysqli->connect_errno) { printf("connection failed: %s\n", $mysqli->connect_error); exit; } ?> 

this query not modifying database reason. know 'database.php' valid, , don't error if(!$stmt) section. nothing breaks, doesn't modify table, userinfo. can tell me why?

change $user $username. binding , inserting $username $_post , define $user


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -