You could try:
Add User Code:
<?
function mydbconnect ($host,$user,$password,$db)
{
$link = @mysql_pconnect("$host","$user","$password");
if ($link && mysql_select_db ("$db"))
return ($link);
return (FALSE);
}
$acctype = "Free SubDomain";
$address = "$add1\n$add2\n$town\n$county\n$postcode";
require "config_inc.php";
my_db_connect($host,$user,$password,$db);
$query = "INSERT INTO $tablename VALUES('$username','$pass','$fname','$lname','$address','$url','$email', '$acctype')";
$exec = MYSQL_QUERY($query)
or die ("<h1>Cannot Execute Query:</h1><br>$query<br>".mysql_error());
if ($exec) {
PRINT "Created new user $inputuser with password $inputpassword";
} else {"<h1>Cannot Execute Query:</h1><br>$query<br>".mysql_error());
}
MYSQL_CLOSE();
?>
Search user code:
<?
require "config_inc.php";
function mydbconnect ($host,$user,$password,$db)
{
$link = @mysql_pconnect("$host","$user","$password");
if ($link && mysql_select_db ("$db"))
return ($link);
return (FALSE);
}
my_db_connect($host,$user,$password,$db);
$query = "SELECT * FROM $tablename WHERE user = '$username'";
$exec = MYSQL_QUERY($query)
or die ("<h1>Cannot Execute Query:</h1><br>$query<br>".mysql_error());
if ($exec) {
0 = first record
1 = second field (password)
$newpassword = mysql_result($exec,0,1);
} else {"<h1>Cannot Execute Query:</h1><br>$query<br>".mysql_error());
}
MYSQL_CLOSE();
PRINT "Your password is: $newpassword";
?>
Ben Periton wrote:
Hi
I am trying to setup a database to store my users in, but i dont think it is storing the details.
I also want to be able to lokup details such as the password, but everytime i try, it says "Warning: Unable to jump to row 0 on MySQL result index 2"
Could someone tell me if there are any errors in my code?
Thanks a lot
ben Periton
Add User Code:
<?
$acctype = "Free SubDomain";
$address = "$add1\n$add2\n$town\n$county\n$postcode";
require "config_inc.php";
MYSQL_CONNECT($hostname, $username, $password) or DIE("Unable to connect to MySQL server");
@mysql_select_db("$dbname") or DIE("Unable to connect to MySQL database");
$query = "INSERT INTO $tablename VALUES('$user','$password','$fname','$lname','$address','$url','$email', '$acctype')";
$exec = MYSQL_QUERY($query);
PRINT "Created new user $inputuser with password $inputpassword";
MYSQL_CLOSE();
?>
Search user code:
<?
require "config_inc.php";
MYSQL_CONNECT($hostname, $username, $pass....