Jump to content

Recommended Posts

Well here is the scripting I have for it right now, it doesn't really work.  It just displays the echo, but doesn't do anything else.

 

<?php
mysql_query("SELECT * FROM users WHERE username='$username'");
$purchase = ($cash-10000);
$heal = ($health+1);

if ($_POST['amount']){
$amount = ($_POST['amount']);
$healing = ($heal*$amount);
$cashloss = ($purchase*$amount);

mysql_query("UPDATE users WHERE health='$healing', cash='$cashloss'");}
?>

Link to comment
https://forums.phpfreaks.com/topic/180314-coding-question/#findComment-951965
Share on other sites

Hi

 

That update statement isn't updating anything, merely finding the row(s) to update (with a syntax error).

 

You would want something like:-

 

UPDATE users SET health='$healing', cash='$cashloss' WHERE username='$username'

 

However you do not appear to be doing anything with the records you have selected at the start of that code fragment.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/180314-coding-question/#findComment-952024
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.