Jump to content


This topic is now archived and is closed to further replies.


$Database Question....

Recommended Posts

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:



@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";


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">

Can anyone assist me?

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
I tried _inv, and also tried mydomain_inv.

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

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.