How to find record ...

admin

Administrator
Staff member
I have a MySQL database. The db contains peoples names and adresses, in addition to other information. Two of the field names are LastName and FirstName. I want to be able to find a record in the database which has fields matching values that I specify. For example, I want find the record for which LastName is "Smith" and FirstName is "John". I have tried the following query, but I am getting an error

SELECT * FROM $tablename WHERE LastName="Smith" AND FirstName="John".

Can anyone suggest, or provide, a short tutorial on how to
1) connect to mysql (to make sure I am doing this correctly)
2) specify the db
3) perform query such as one mentioned above.

Thanks,
Ed
 
Back
Top