3

Sorry if it's a quite simple problem. I am not too experienced with web languages.
Basically, it doesn't work.

$insert=
(
  "INSERT INTO phpbb_members ".
  "(emailAddress, uid, valid, firstandlast, propic, memberName) ".
  "VALUES ($me['email'], $uid, 1, $me['name'], $propic, $newuser)"
);
mysql_query($insert) or die('Error, insert query failed');
1
  • have you tried just running the query using something like phpmyadmin? That may give you some more insight. Perhaps you have a column name typo or you're missing a column. Commented Dec 1, 2010 at 17:46

6 Answers 6

5
$insert="INSERT INTO phpbb_members (emailAddress, uid, valid, firstandlast, propic, memberName)
VALUES ('".$me['email']."', $uid, 1, '".$me['name']."', '$propic', $newuser)";

Missing singular quotes (for strings [varchar, char, text, etc]) and you need to close your quotes and concatenate when referencing an array. The above assumed $uid and $newuser are stored numerically in the DB.

Sign up to request clarification or add additional context in comments.

1 Comment

Exactly, you can't use $me['email'] inside double quotes.
3

I think the problem may be in the way you've laid out the information to be inserted.

This should work:

$insert=("INSERT INTO phpbb_members (emailAddress, uid, valid, firstandlast, propic, memberName)
VALUES ('$me[email]', '$uid', '1', '$me[name]', '$propic', '$newuser')");
        mysql_query($insert) or die('Error, insert query failed');

Hope it helps!

EDIT: I'm pretty sure the information to be inserted has to be inside ' '.

1 Comment

Thanks this fixed the problem, I hate PHP and all its ' :(
3

If you'll use the following for testing, it will show you the error:

mysql_query($insert) or die(mysql_error()."<br />".$insert);

Comments

2
$insert=("INSERT INTO phpbb_members (emailAddress, uid, valid, firstandlast, propic, memberName) 
VALUES ($me['email'], $uid, 1, $me['name'], $propic, $newuser)"); 

Do wee need those extra brackets in the beginning and end? Try to remove it and execute.

$sql = "SELECT * FROM Person";
mysql_query($sql,$con);

Comments

2
$insert=("INSERT INTO phpbb_members (emailAddress, uid, valid, firstandlast, propic, memberName)
VALUES ('".$me['email']."','". $uid."',1,'". $me['name']."','" .$propic."','". $newuser."')");
mysql_query($insert) or die('Error, insert query failed');

Comments

2

Try the following code,

 $insert=("INSERT INTO phpbb_members (emailAddress, uid, valid, firstandlast, propic, memberName) VALUES ('{$me['email']}', '{$uid}', '1', '{$me['name']}', '{$propic}', '{$newuser}')");
mysql_query($insert) or die('Error, insert query failed');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.