FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Problem creating new table and inserting

 


Saysior
Code:
<html>
<head>
</head>
<body>
<img src="saysiorbanner.jpg" width="100%">
<?php
$title = $_POST['title'];
$type = $_POST['type'];
$content = $_POST['content'];
$password = $_POST['password'];
$docname = $_POST['docname'];
$date = date("Y/m/d");
$summary = $_POST['summary'];
$comments = $_POST['comments'];
$con = mysql_connect("localhost", "*******", "******");
mysql_select_db("********", $con) or die(mysql_error());
$ins = mysql_query("INSERT INTO documents (title, type, date, content, docname, summary, comments) VALUES ($title, $type, $date, $content, $docname, $summary, $comments)");
mysql_close($con);
if ($ins) {
echo "<br><br><br><center>Nice work.  " . $title . " has been uploaded and is now available for the public to view.";
}
else {
echo "There was a problem";
}
?>
</body></html>


I've been tweaking this code for a while and I can't get it to work. What really bugs me is that I've written stuff like this before, so I have no idea why I can't get it to work now. Would anyone who can please tell me where I went wrong with this? $ins has been returning false, and I've looked at my database records. Thank you so much in advance.


EDIT: I found some old code that does what I want this code to do, and it works, so I no longer have a problem.


Last edited by Saysior on Sun Sep 09, 2007 9:24 pm; edited 1 time in total
coreymanshack
the documents table doesn't exist yet?
Saysior
No, I specifically created it. But I've found some old script I wrote a while back that did essentially the same thing. I can't figure out the difference, but this one works, so help is no longer needed. Thank you very much anyways.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.