PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Notice: Undefined index: memberID in /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php on line 81
Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'where clause' in /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php:82 Stack trace: #0 /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php(82): PDO->prepare('SELECT * FROM t...') #1 {main} thrown in /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php on line 82
above was the result can anybody help me with this
Problem 1. You create $username and then don't use it.
Problem 2. You have a variable $memberID that comes out of nowhere that you do not use.
Problem 3. The table transfer does not have a column named or spelled username
Problem 4. You never ever put variables in a query. You need to use Prepared Statements
Notice: Undefined index: memberID in /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php on line 81
Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'where clause' in /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php:82 Stack trace: #0 /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php(82): PDO->prepare('SELECT * FROM t...') #1 {main} thrown in /opt/lampp/htdocs/wwwroot/firstrepus/transfersta.php on line 82
above was the result can anybody help me with this
First you have problem in username because you use memberiD
$stmt = $db->prepare("SELECT * FROM transfer WHERE username ='$memberID'");
REPLACE WITH
$stmt = $db->prepare("SELECT * FROM transfer WHERE username ='$username'");