MasterACE14 Posted July 14, 2008 Share Posted July 14, 2008 I have a script that runs fine. Except for throws a strange error. I've checked through my file. Its not a custom error, and it doesn't look like a PHP error, and I'm not sure whether it might be a MySQL error. Its really strange. I have 2 pages. The first one has some forms, and depending which form is filled out and submitted to the second page. That if(isset($_POST['whatever'])) will run. When the first page, submits a form to the second page. The second page is suppose to redirect back to the first after updating the database with the new info. However, it is updating the database how it should be. But isn't redirecting to the first page and is displaying this peculiar message: Failed to attribute action. here is the second page which displays this message after executing the required code ???: <?php session_start(); if (isset($_SESSION['id'])) { include('common.php'); include('libvars.php'); $sql = "SELECT * FROM `UserInfo` WHERE `id` = '$id'"; if (!($result = $db->sql_query($sql))) { die('Failed to query database userinfo.'); } if (mysql_num_rows($result) > 0) { $row = $db->sql_fetchrow($result); // a heap of variables below. don't worry, they are all set in my script $clanID = $row['clan']; $turns = $row['AT']; $magi = $row['magi_ava']; $banks = $row['magivault']; } if (isset($_POST['prosp_amt'])) { $increment = ceil($_POST['prosp_amt']); if ($increment < 0) { $timez = time(); $sql = "INSERT INTO `cheatlog` (`id`, `page`, `time`, `type`) VALUES ('$id', 'tech2 / Prosperity / $increment', '$timez', 'negative')"; if (!($result = $db->sql_query($sql))) { die('Failed to query database.'); } $increment = 0; } $mod_prosp = $prosp_tech + $increment; $prosp_price = (-1 * ($prosp_tech - $mod_prosp)) * (((170000 * ($mod_prosp - 1) + 170000 * ($prosp_tech + (28 / 17))) / 2)); if ($magi >= $prosp_price) { if ($magi > 0) { if ($mod_prosp <= 100) { $mod_prosp_amt = $prosp_amt + ($increment * $prosp_bon); $prosp_tech_mod = $prosp_tech + $increment; $sql = "UPDATE `UserInfo` SET `prosp_amt` = '$mod_prosp_amt', `prosp_tech` = '$prosp_tech_mod' WHERE `id` = '$id'"; if (!($result = $db->sql_query($sql, $id))) { die('Failed to query database userinfo.'); } $mod_magi = $magi - $prosp_price; $sql = "UPDATE `UserInfo` SET `magi_ava` = '$mod_magi' WHERE `id` = '$id'"; if (!($result = $db->sql_query($sql, $id))) { die('Failed to query database userinfo.'); } $count++; $done = "Your Realm Evolved Their Prosperity For " . number_format($prosp_price) . " Copper"; } else { $done = "That Would Put You Above Your Realm's Evolutionary Capacity"; } } else { $done = "Your%20Realm%20Is%20Delinquent!!"; } } else { $done = "Your Realm Needs " . number_format($prosp_price) . " Copper In Order To Evolve To That Level"; } } include('includes/powers.inc.php'); header('Location: tech.php?str=' . $done . '!'); } else { header('Location: index.php?str=You%20Are%20Not%20Logged%20In!%20Please%20try%20again.'); exit; } ?> -Edit: uhh is it just me, or is my code coming up all weird :S Any help is greatly appreciated! Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/114613-solved-a-strange-error-not-sure-whether-is-mysql-related-or-php-or-something-else/ Share on other sites More sharing options...
.josh Posted July 14, 2008 Share Posted July 14, 2008 I have to disagree with you there bud. You said it's not a custom error message, but your error messages in that code block are the same format as that. Perhaps powers.inc.php is the culprit? Quote Link to comment https://forums.phpfreaks.com/topic/114613-solved-a-strange-error-not-sure-whether-is-mysql-related-or-php-or-something-else/#findComment-589295 Share on other sites More sharing options...
MasterACE14 Posted July 14, 2008 Author Share Posted July 14, 2008 Ah, good catch. The problem was in power.inc.php , there was a table name with a typo. Thanks again ACE Quote Link to comment https://forums.phpfreaks.com/topic/114613-solved-a-strange-error-not-sure-whether-is-mysql-related-or-php-or-something-else/#findComment-589554 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.