I am able to insert fixed values into a known working mysql db. The values "hello" and "test" get inserted just fine but the username variable does not. Ultimately I will pass the variables from a web form. I am using a phpadmin tool which has generated the escape characters. I can perform an update using variables. Here's the code: (Thank You much for any help!)
<?php
$password = $_REQUEST['password'];
$username = "datatrac";
$sysusername = "datatrac";
$syspassword = "*******";
$host="datatrac.startlogicmysql.com";
$database="datatrac_test";
$conn = mysql_connect($host,$sysusername,$syspassword);
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($database);
if (!$db_selected) {
die('Could not select database: ' . mysql_error());
}
mysql_select_db($database, $conn);
$sql = 'INSERT INTO `cust` (`lookupname`, `lname`, `fname`, `telephone1`, `email`, `street`, `apartment`, `city`, `state`, `zipcode`, `cellphone`, `website`, `username`, `password`, `vote1`, `comments1`, `vote2`, `comments2`, `vote3`, `comments3`, `category1`, `category2`, `country`, `occupation`) VALUES (\'Hello\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'$username\', \'\', \'\', \'test\', \'\', \'\', \'\', \'\', \'0\', \'0\', \'\', \'\');';
$result = mysql_query($sql);
if (!$result) { $msg = "Update Failed: " . mysql_error(); }
else
{
$msg = "Updated article successfully.";
}
mysql_close($conn);
?>