I am currently using a version of phpmyadmin via heartinternet.
I can connect to my database fine, but I cannot seem to input any database into the table I have created.
the database is called "web-32jerry" and the table is called "login" for reference sake.
The code i have at the moment has 2 text boxes which they input their username and password in and then a submit button attached.
I have taken bits from 2 different tutorials to help me so they are probably bits of code in there that i dont even need so it will look messy!!
the code i have is the following;
[code=php]
<form method="post">
<p>Username -
<input name="user" type="text" id="user" size="15">
<br>
Password -
<input name="pass" type="text" id="pass" size="15">
<br> <input name="add" type="submit" id="add" value="add">
</form>
<?php
if(isset($_POST['add']))
{
mysql_connect(" localhost", "web32-jerry", "my password")
OR die ("Can't Access any database.");
mysql_selectdb( "web32-jerry")
OR die ("Cant access the 'jerry' database.");
$user= $_POST['user'];
$pass = $_POST['pass'];
$query = "INSERT INTO login (host, user, pass, select_priv, insert_priv, update_ priv) VALUES ('localhost', '$user', PASSWORD('$pass '), 'Y', 'Y', 'Y')";
mysql_query($qu ery) or die('Error , insert query failed');
$query = "FLUSH PRIVILEGES";
mysql_query($qu ery) or die('Error, insert query failed');
}
?>
[/code]
any help given i will be very greatful for...
thank you very much,
Jerry
I can connect to my database fine, but I cannot seem to input any database into the table I have created.
the database is called "web-32jerry" and the table is called "login" for reference sake.
The code i have at the moment has 2 text boxes which they input their username and password in and then a submit button attached.
I have taken bits from 2 different tutorials to help me so they are probably bits of code in there that i dont even need so it will look messy!!
the code i have is the following;
[code=php]
<form method="post">
<p>Username -
<input name="user" type="text" id="user" size="15">
<br>
Password -
<input name="pass" type="text" id="pass" size="15">
<br> <input name="add" type="submit" id="add" value="add">
</form>
<?php
if(isset($_POST['add']))
{
mysql_connect(" localhost", "web32-jerry", "my password")
OR die ("Can't Access any database.");
mysql_selectdb( "web32-jerry")
OR die ("Cant access the 'jerry' database.");
$user= $_POST['user'];
$pass = $_POST['pass'];
$query = "INSERT INTO login (host, user, pass, select_priv, insert_priv, update_ priv) VALUES ('localhost', '$user', PASSWORD('$pass '), 'Y', 'Y', 'Y')";
mysql_query($qu ery) or die('Error , insert query failed');
$query = "FLUSH PRIVILEGES";
mysql_query($qu ery) or die('Error, insert query failed');
}
?>
[/code]
any help given i will be very greatful for...
thank you very much,
Jerry
Comment