What is the best site for learning PHP? Or book? I got the basic syntax down in expressions, loops, operators, classes, functions etc. (much the same as C++) But I'm still very confused on how these queries work (ie. $DB_site->query_first("SELECT userid,username, blah blah blah");
new riders do a good mysql book (search on Amazon - its by Paul Dubois). I found it indispensible for learning mySQL anyway - also check out the entity relationship diagrams available on vbulletin.com - they explain the relationships between the database tables...
New Riders' "MySQL" book is great. I bought it myself when I first started and it's a huge fountain of knowledge.
If you are talking about classes ($DB_site->query(...)) there's a mediocre tutorial that explains the basics at SitePoint (by Kevin Yank -- which has a good book (according to what others say) on PHP combined with some MySQL if you want).