Ok here is the thing, I have been working on building my own personal shop system them relies on a unit of payment called credits which a set amount of credits can be paid for via real money. The thing is though, this is my first real big project using a database outside of storing data for a video game, and i keep running into tiny problems. On problem I am having now is with this code:
Code:
- $vf_username = $user_info[user_name];
- $data['credits'] = $new_total;
- $credits = mysql_query("SELECT * FROM credits WHERE user_name = '$vf_username'") or die(mysql_error());
- $credit_info = mysql_fetch_array($credits);
- if($credit_info['credits'] => $total) {
- $new_total = $credit_info['credits'] - $total;
- $db->query_insert("credits", $data);
- } else {
- echo "You need more credits to make this purchase. You can purchase credits by <a href=\"#\">clicking here</a>.";
- }
for some reason it is giving me this error:
Code:
- Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/tameron/public_html/divineshadowsonline.com/store/cart/index.php on line 69
What that code there does is check my database for the amount of credits assigned to that account by running a check on the username, matching up with the username assign in the array first. Then it runs a check to see if the user has equal to or more credits then the total amount of all the objects they want to buy. If they have more or equal to the amount, then the sum of their credits minus thats of the total sum becomes a new variable called $new_total, which is them wont to the database, over their old amount of credits. But if they don't have equal to enough they get the "You need more credits to make this purchase." message.
Over all the idea is sound, ut I have no idea why i am getting the T_DOUBLE_ARROW error![]()
Your issue is this line...
Your operator is wrong, change it to <= (or >= depending on which side of the operator has the credits available).
![]()
oh ok thank you so much![]()