Hello, I am currently having problems with databases in mysql. As of now, I have a basic script in which the user will input data into 7 text field, and hit the submit button.
My real problem is that for some reason I am unable to access my database through php.
I have it set up like so:
I have the <? and the ?>, so this isn't the problem, this is a small chunk.
When I run the script on my page though, it returns "Unable to select database". Why? Am I doing something wrong? What can I do to fix this problem? I am very new to scripting, so the problem is probably something basic. Anyone know what is wrong?
My real problem is that for some reason I am unable to access my database through php.
I have it set up like so:
PHP:
$username="*******";
$password="********";
$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");
I have the <? and the ?>, so this isn't the problem, this is a small chunk.
When I run the script on my page though, it returns "Unable to select database". Why? Am I doing something wrong? What can I do to fix this problem? I am very new to scripting, so the problem is probably something basic. Anyone know what is wrong?