So I am still learning PHP and PDO and I am trying to compare a name that was wrote in a text box to what I have in my database. I tried with a query but the problem was when it found a matching first name in the database it would print it out regardless of if the last name and first name were together. Now I searched around and found prepare and using WHERE ... and that may be working but I can't figure out how to print the value from the database, with the query it was
and I could use the $cert['xxxxx']; to see the value from the database but with this prepare I can't figure out how to display what is in the database. my php currently looks like:
The entire purpose is to build an image, a certificate, that users get when they pay their fees, I have the generating down and all that working but now I want to make sure that it reads from the database and knows who has paid and no. Basically if they are in the database they have paid so I have a
which shows the result from the form on the html page, that is supposed to be compared to the fname from the database, I think that is happening now but I need something to store in my $Name variable which is what is put onto the certificate, I can't use the $fnameForm because if they put in an incorrect name it would generate it anyway, I need to use the fname from the database but I don't know how to use that. Also will that code work for making sure that the name entered in the form is the same as the one stored in the database, also I know I could use strtolower($lnameform/$fnameForm) to make it lower case to check to make it more accurate but how can I do that with the fname and the lname of the database. I am still in the learning stages of PHP and I have been using my resources as best as I can, the PHP PDO manual and websites like this and StackOverflow, please help a beginner out.
PHP:
foreach(db->query('SELECT........') as $cert) { }
and I could use the $cert['xxxxx']; to see the value from the database but with this prepare I can't figure out how to display what is in the database. my php currently looks like:
PHP:
$query = $db->prepare('SELECT UID, fname, lname, Date_Reg FROM users WHERE fname = :fnameForm && lname = :lnameForm');
$query->bindValue(':fnameForm', $fnameForm);
$query->bindValue(':lnameForm', $lnameForm);
The entire purpose is to build an image, a certificate, that users get when they pay their fees, I have the generating down and all that working but now I want to make sure that it reads from the database and knows who has paid and no. Basically if they are in the database they have paid so I have a
PHP:
$fnameForm $_GET['fname'];
which shows the result from the form on the html page, that is supposed to be compared to the fname from the database, I think that is happening now but I need something to store in my $Name variable which is what is put onto the certificate, I can't use the $fnameForm because if they put in an incorrect name it would generate it anyway, I need to use the fname from the database but I don't know how to use that. Also will that code work for making sure that the name entered in the form is the same as the one stored in the database, also I know I could use strtolower($lnameform/$fnameForm) to make it lower case to check to make it more accurate but how can I do that with the fname and the lname of the database. I am still in the learning stages of PHP and I have been using my resources as best as I can, the PHP PDO manual and websites like this and StackOverflow, please help a beginner out.