PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Since you're using strings delimited with single quotes ' ... ' you need to escape all single quotes in between.. As explained in the strings section in the manual.
Btw, you are not validating input at all..
And you are not preparing that input for use in a (my)sql query either.. (http://www.php.net/mysql_real_escape_string)
What would happen if your name was "John O'Reilly?".
I usually find it easier to use double quotes when variables are involved
<b><?php
$DBHOST = 'localhost';
$DBUSER = '*******';
$DBPASS = '******';
$DBNAME = '*********';
if($_POST['submit']);
$dbconnect = mysql_connect($DBHOST,$DBUSER,$DBPASS) or die('Err:Unable to connect to database');
@mysql_select_db($DBNAME) or die("Unable to select database ".$dbname);
$sqlquery = "INSERT INTO Users (LastName,emailaddress) VALUES ('".$_POST['LastName']."','".$_POST['emailaddress']."')";
$results = mysql_query($sqlquery) or die ("Could not insert record into db:" . mysql_error());
mysql_close();