Thank you for the advice! this is a small shop, that's why i used the IP to identify users, but like you said, this can give me serious problems, i need to change it... I'll read the link you posted, and study more about the PDO. I was following like 2 or 3 tutorials of ecommerce in internet, but all of them got some problems that i need upgrade it by my self, like valid/duplicated email, prevent sql injection, php injectin, xss attack, etc.
My page functions.php got the mosts of the calcs, i was testing some things to implement later, at this point i stayed at the beginning. In last case i'll write every thing again. I got some products here to sell and i'm studing web languages to improve my curriculum too... in my university i only study C and Java or C#, i'm learning at home with internet, thanks you two again, the opinions and advice, i really appreciate it!