title: Access denied for user 'name'@'localhost' (using password: NO)
body: <p>I am trying to create a cron job in which it will send a mail when my inventory stocks are low. The email is just sending me the error code above, even though my database settings are accurate. So here is my code: </p>
  
  <pre><code>&lt;?php
  
  //I just renamed them, but you get the concept
  $db_host = "mydbhost";
  $db_username = "myusername";
  $db_password = "mypassword";
  $db_name = "mydatabase";
  
  $conn = mysqli_connect($db_host,$db_username,$db_password,$db_name) or die ('MySQL Not found // Could Not Connect.');
  
  $recipient = "email@email.com";
  
  $result = mysql_query("SELECT prod_count, restock_level FROM mydatabase WHERE prod_count &lt;= restock_level;");
  if ($result) {
    $row = mysql_fetch_assoc($result);
    $count = $row['prod_count'];
    $restocklvl = $row['restock_level'];
    if ($count &lt;= $restocklvl) {
      $msg = "Your inventory is currently low. Please restock.";
      mail($recipient, "Inventory check below threshold", $msg);
    }
  }
  else {
    $msg = "An error occurred while checking inventory: " . mysql_error();
    mail($recipient, "Inventory check error", $msg);
  }
  ?&gt;
  </code></pre>
  
  <p>What seems to go wrong? Thanks! <a href="http://i.stack.imgur.com/dLriU.png" rel="nofollow">Here is the image of the email</a></p>