The one mistake I did in the beginning of my programming days, is not use a database class there are many out there, i have one that i have added to over the years, but this will speed up your development time. As far as database goes there are so many rules and things you learn with trial and error... the internet is a great resource. SQL is pretty easy to pick up.
I dont know what your level is so ill go over some basics that i know of...
I would say a few do's and don'ts
Dont
name your database, tables, & columns common names ie "users", "products" come up with your own naming structure something like
database : prod_dbb9
table : tbb_users
column : u_uid, u_userid
This will prevent someone from guessing your tables or database structure and allow you to hack your db.
Sql injection is pretty easy to do... so always escape your sql commands to the database! PHP has a built in function for that mysql_real_escape_string
always remember ID numbers are easier on the database than text so if you can pull records by id numbers
ie: profile.php?id=123 rather than profile.php?username=jason
Kind of obvious but don't name your querystrings the same as your columns in your db ie
profile.php?u_userid=123
If you are deletin only one record make sure to put "limit 1" at the end of your SQL this will help prevent more records from getting deleted by hackers.
Always encrypt your users passwords. You can choose to use php MD5() but be aware that this is one way encryption...(no one can ever see this password again) so if your user forgets their password you will have to generate them a new password and mail it to them...
Well thats all i got for now..
good luck!