Jump to content

a hand if you please


Phpfr3ak

Recommended Posts

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

"'     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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.