php - Add Script Not working
<p>I'm having a problem with my update script. Basically I enter values into textboxes and when I click on 'Add' these values get added to the database.</p>

<p>At the moment it is allowing me to enter intergers and these getting added to the database but when I try to add text it doesn't. The database field types are set to varchar(20) and this is my PHP code:</p>

<pre><code>public function insert($tableName,$fieldArray,$fieldValues) {

    $pdo = new SQL();
    $dbh = $pdo-&gt;connect(Database::$serverIP, Database::$serverPort, Database::$dbName, Database::$user, Database::$pass);


    $this-&gt;sql = "INSERT INTO " . $tableName . " (".implode(',', $fieldArray).") VALUES (".implode(',', $fieldValues).")";

try {
        // Query
        $stmt = $dbh-&gt;prepare($this-&gt;sql);

        $stmt-&gt;execute();

        $count = $stmt-&gt;rowCount();

        echo $count.' row(s) inserted by SQL: '.$stmt-&gt;queryString;

        $stmt-&gt;closeCursor();

    }

    catch (PDOException $pe) {
        echo 'Error: ' .$pe-&gt;getMessage(). 'SQL: '.$stmt-&gt;queryString;
        die();
    }

    // Close connection
    $dbh = null;
}
</code></pre>

<p>Please let me know what I am doing wrong! :)</p>
