Hi,
I have been bashing my head against a wall for some time now trying to figure this out for the past few days and have had NO luck in figuing it out, if someone with PHP/MySQL knowledge can look it over and tell me why it does not return the users name from the database, and the entered account number (ID) from the form I would much appreciate it!
<pre>
<?
if ($subchk == 1) {
$name = \"[account name]\";
$pass = \"[account password]\";
$db = \"[account database]\";
mysql_connect(\"localhost\",$name,$pass)
or die (\"Couldn\'t connect to MySQL - Invalid User or Password\");
mysql_select_db($db)
or die (\"Couldn\'t open $db: \".mysql_error());
$q = \"SELECT name FROM account_details WHERE acc_id = \\"$acc_id\\"\";
$acc_name = mysql_query ($q) or die (\"Could not retrive any matching records!\");
$num = mysql_numrows ($acc_name);
if ($num != 1) {
$acc_name = \"\";
echo \'
<p>Invalid Account Number:- Please
check and try again!</p>
<form name=\"acc_id_frm\" method=\"post\" action=\"?action=services\">
<input type=\"hidden\" name=\"subchk\" value=\"1\">
Account #:
<input CLASS=\"text\" type=\"text\" name=\"acc_id\" size=\"20\" maxlength=\"8\"> ››› <input type=\"submit\" name=\"Submit\" value=\"Submit\">
</form>
\';
}
else {
echo \'
<p>Welcome Back $name ( $acc_id )</p>
\';
}
}
else {
echo \'
<form name=\"acc_id_frm\" method=\"post\" action=\"?action=services\">
<input type=\"hidden\" name=\"subchk\" value=\"1\">
Account #:
<input CLASS=\"text\" type=\"text\" name=\"acc_id\" size=\"20\" maxlength=\"8\"> ››› <input type=\"submit\" name=\"Submit\" value=\"Submit\">
</form>
\';
}
?>
</pre>
Any help, please....