neex1233 Posted June 21, 2009 Share Posted June 21, 2009 Right now I'm trying to create a online store in PHP (no real money, just tokens). I have a few problems. First, I have no idea how to know if the user has enough tokens to buy the an object, and second I don't know how it would record what they buy to a MySQL database. Can I have any help? I wrote a small script with an idea of how I will do it: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); require '/home/username/public_html/folder/config.php'; $username = mysql_real_escape_string($_SESSION['username']); $price = mysql_real_escape_string($_POST["price"]); $pro = mysql_real_escape_string($_POST["product"]); $sql = "UPDATE users SET tokens=(tokens-$price) WHERE username='$username'"; mysql_query($sql); echo "Thank you for buying $pro!"; ?> Link to comment https://forums.phpfreaks.com/topic/163166-creating-a-php-online-site-store-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.