I'm close but stuck. I pull the user name from drupal and store it in a variable called $username, I want to store this in a column called username. However the below code throws up an error
$sql = "INSERT INTO sheet_tbl (site_id, user_id, eventdate, eventtime, username) VALUES ('$_POST[site_id]','$_POST[user_id]','$_POST[eventdate]','$_POST[eventtime]',$username)";
Error
warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near ")" at character 112 in /var/www/html/drupal1/includes/common.inc(1743) : eval()'d code on line 30.
I pull the user name using:
User Name: <?php
global $user;
echo $user->name;
$username = $user->name;
?>
If i echo this variable i get the result = admin