Help INSERTing to MySQL

From: Date: Sat, 24 Feb 2001 01:00:30 +0000
Subject: Help INSERTing to MySQL
Groups: php.general 
Request: Send a blank email to php-general+get-41389@lists.php.net to get a copy of this message
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" ---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>"; } } ?> <h1>Submit a new document to the database</h1> <form> Email Address: <input type=text name=email><br> Category: <select name=category><? print "$CATEGORIES" ?></select><br> Sub Category: <select name=subcategory><? print "$SUBCATEGORIES" ?></select><br> Date Document was written: <input type=text name=date> (xx-xx-xxxx)<br> Document Subject: <input type=text name=subject><br> Document Title: <input type=text name=title><br> Document Author: <input type=text name=author><br> Document Language: <input type=text name=language value=English><br> Grade Received (Percentage): <input type=text name=grade size=3> (xx/100)<br> Grade Level of Paper: <select name=level><option>High School</option><option>College</option><option>Other</option></select><br> City in which paper was submitted: <input type=text name=city value=Jacksonville><br> State in which paper was submitted: <input type=text name=state value=FL><br> County in which paper was submitted: <input type=text name=county value=Duval> <b>(County, not Country!)</b><br> School at which paper was submitted: <input type=text name=school value="Mandarin High School"><br> ZIP code: <input type=text name=zip size=5 value=32257> <b>(Put your ZIP code in if you don't know your school's)</b><br> Author's Comments: <input type=text name=authors_comments><br> Teacher's Comments: <input type=text name=teachers_comments><br> Document (ASCII TEXT ONLY):<br> <textarea name=docdata cols=80 rows=30>Paste document text here</textarea> <p><input type=submit value="Submit for verification"> </form> -----END----- TIA! Clayton

« previous php.general (#41389) next »