Phpfr3ak Posted February 19, 2011 Share Posted February 19, 2011 Hey, The code below for some reason is showing; Hoes: 20000 Morale: 4.10 (hoes * hoe_morale * 2)); cred. Any ideas why i need it to show the actual result not the Maths thanks. <?php if($_GET['password']!="1234") { die("You do not have access to this page."); } else { include("functions.php"); include("db_connection.php"); $sql = "UPDATE users SET cash = cash + hoes * hoe_morale * 150, cred = cred + hoes * hoe_morale * 2 WHERE is_active = 1"; mysql_query($sql) or die(mysql_error()); $sql2="INSERT INTO messages (to_username,message,type, timestamp) VALUES('$playerdata[username]',' Hoes: $playerdata[hoes] Morale: $playerdata[hoe_morale] (hoes * hoe_morale * 2)); cred','player', NOW())"; mysql_query($sql2) or die(mysql_error()); echo "Ho Income complete"; } ?> Link to comment https://forums.phpfreaks.com/topic/228232-a-hand-if-you-please/ Share on other sites More sharing options...
requinix Posted February 19, 2011 Share Posted February 19, 2011 "' Hoes: $playerdata[hoes] Morale: $playerdata[hoe_morale] (hoes * hoe_morale * 2)); cred'" You put the string right in there. If you don't want it like that then change it. Your logic is all messed up. Spend a minute to think about what it does and compare that with what you want it to do. Link to comment https://forums.phpfreaks.com/topic/228232-a-hand-if-you-please/#findComment-1176956 Share on other sites More sharing options...
Phpfr3ak Posted February 19, 2011 Author Share Posted February 19, 2011 How does puttin the string right in there effect it, i'm not that advanced in php and dont really see how it would be fixed in all honesty. Link to comment https://forums.phpfreaks.com/topic/228232-a-hand-if-you-please/#findComment-1176966 Share on other sites More sharing options...
requinix Posted February 20, 2011 Share Posted February 20, 2011 Put the message issue aside for a moment. You've got a larger problem. $sql will update every single user with the new values for cash and cred. I guess this is something you'll execute once in a while (like once an hour or once a day)? But your $sql2 only works on one specific user. If you want a message for every user then you need to make it do that; otherwise you're limited to a message about the batch update in its entirety. Link to comment https://forums.phpfreaks.com/topic/228232-a-hand-if-you-please/#findComment-1176972 Share on other sites More sharing options...
Phpfr3ak Posted February 20, 2011 Author Share Posted February 20, 2011 Thanks i didn't spot that at all, Fixed the initial error, And corrected that, Thanks alot! Link to comment https://forums.phpfreaks.com/topic/228232-a-hand-if-you-please/#findComment-1176993 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.