sports Posted May 10, 2006 Share Posted May 10, 2006 Hi there, In a .php file, when you see the $database variable, and I have a database created called _inv, what do you put here? I tried _inv, and also tried mydomain_inv.Here is the php file text:<?$username="username";$password="password";$database="your_database";$first=$_POST['first'];$last=$_POST['last'];$phone=$_POST['phone'];$mobile=$_POST['mobile'];$fax=$_POST['fax'];$email=$_POST['email'];$web=$_POST['web'];mysql_connect(localhost,$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";mysql_query($query);mysql_close();?>I am trying to use a Front Page form to write to the db using the php file.Here is the Form Text:<form action="insert.php" method="post">First Name: <input type="text" name="first"><br>Last Name: <input type="text" name="last"><br>Phone: <input type="text" name="phone"><br>Mobile: <input type="text" name="mobile"><br>Fax: <input type="text" name="fax"><br>E-mail: <input type="text" name="email"><br>Web: <input type="text" name="web"><br><input type="Submit"></form>Can anyone assist me?Regards,Rob Quote Link to comment Share on other sites More sharing options...
ober Posted May 10, 2006 Share Posted May 10, 2006 What are you using to edit the MySQL tables? It should say in there what the name of the database is. If it is, in fact, "_inv", then that's all you should have to put in there.Remove the @ symbol from the mysql_select_db() function and see if you get any errors. Quote Link to comment Share on other sites More sharing options...
.josh Posted May 10, 2006 Share Posted May 10, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] I tried _inv, and also tried mydomain_inv.[/quote]it should be mydomain_inv but, it is only up to the first 8 letters, so for instance, if your domain was abc.com then it would be abc_inv but if it was something longer like reallylongurl.com then it would actually be reallyl_inv Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.