I'm having issues as well; I have a database jokes with a couple rows already and am trying to insert another row (the ID is auto incrementing). This is what I have, as you can see I'm trying to insert a value from a form.
Here's the form
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Type your joke here:<BR>
<TEXTAREA NAME="joketext" ROWS=10 COLS=40 WRAP>
</TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="submitjoke" VALUE="SUBMIT">
</FORM>
and the php
$joketext = $_POST['joketext'
if ("SUBMIT" == $_POST['submitjoke']) {
$sql = "INSERT INTO Jokes VALUES ($joketext, CURDATE())";
if (mysql_query($sql)) {
echo("<P>Your joke has been added.</P>");
} else {
echo("<P>Error adding submitted joke: " .
mysql_error() . "</P>");
}
}
It comes back with the error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2), what does that mean?