• I have reposted this in the correct catagory

    I have been losing my mind (what little I have left) over this line of code.

    $wpdb->query(“INSERT INTO ” $wpdb->$table_name (time, date, glucose, fast, comment) VALUES (‘ ” . time() . ” ‘,’ ” . date() . ” ‘,’ ” . $wpdb->escape($gluc) . ” ‘,’ ” . $wpdb->escape($fast) . ” ‘,’ ” . $wpdb->escape($comment) . ” ‘));

    It generates the dreaded “Parse error: syntax error, unexpected T_VARIABLE” message.

    Can anyone please tell me what is wrong with this line of code?

    Thanks in advance,
    Jim

Viewing 1 replies (of 1 total)
  • Maybe try:

    <?php
    $wpdb->query("
    	INSERT INTO " . $wpdb->table_name . "(time, date, glucose, fast, comment)
    	VALUES (' " . time() . " ',' " . date() . " ',' " . $wpdb->escape($gluc) . " ',' " . $wpdb->escape($fast) . " ',' " . $wpdb->escape($comment) . " ');
    	");
    ?>

    Best to use backticks on column names:)

Viewing 1 replies (of 1 total)
  • The topic ‘unexpected T_VARIABLE Problem’ is closed to new replies.