i've got a db query in php that's not placing into database. Used this format plenty of occasions but for whatever reason it is not working now. any ideas please

    $query = "INSERT INTO `databasename`.`member_users` (`id`, `first_name`, `last_name`, `username`, `password`, `address1`, `address2`, `postcode`, `access`, `expires`) VALUES (NULL, '$fname', '$lname', '$email', '', '$add1', '$add2', '$postcode', '0', '')";
$result = mysql_query($query);
    echo"query inserted";


    echo "nope";

Rather than echo "nope"; I would recommend something similar to :

echo 'error while inserting : ['.mysql_errno().'] '.mysql_error();
echo 'query : '.$query;

By doing this you'll have the ability to begin to see the exact error and also the query which was performed.

It's really a many things :

  1. Constraint error having a foreign key
  2. Data type error
  3. Non-existent area
  4. Wrong database or table title

Rather than...

$query = "INSERT INTO `databasename`.`member_users` ..."


$query = "INSERT INTO member_users ..."

Hope it really works. :)