> Hello, This is my first attempt, so I'm prolly doing something stupid,
> but can someone tell me why this doesn't work? All it returns is
> "Unable to INSERT to database"
Change : or die("Unable to INSERT to database");
To : or die(mysql_error());
And see what it tells you. Odds are there's a field not being accounted
for. When not designating columns (just values) it's important to make
sure all columns are accounted for. See :
http://www.sqlcourse.com/
It'll provide some basic SQL help. It's recommended to write out columns
and values (easier to make sense of).
Regards,
Philip Olson
http://www.cornado.com/
>
>
> ---BEGIN---
> <?
> $time = time();
> $rand = Random_Password(5);
> $docid = $time . $rand;
>
> if (isset($email) && isset($docid)) {
> mysql_connect("$HOSTNAME", "$DB_USER", "$DB_PASS");
>
> $query = "INSERT INTO documents VALUES ('$docid', '$category',
> '$subcategory', '$date', '$subject', '$title', '$author', '$email',
> '$language', '$gr ade', '$level', '$city', '$state', '$county',
> '$zip', '$authors_comments', '$teachers_comments', 'N', '$docdata')";
>
> $result = mysql_db_query("$DATABASE", $query) or die("Unable to
> INSERT to database");
>
> if ($result) {
> echo "<p>$docid was added to the database</p>";
> }
> }
> ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]