Dethman Posted January 4, 2008 Share Posted January 4, 2008 What is the error in this? function BuyMS($user, $wal, $type) { $noNaquadah = "Not enough Naquadah!"; $nosold = "Not enough untrained units!"; if ($type == 0) { $pris = 350000000 * $wal; if ($pris <= ($user->gold)) { $q = @mysql_query("select Mothership from `UserDetails` where ID='$user->ID' "); $el = mysql_fetch_array($q, MYSQL_ASSOC); if ($el[] >= $wal) { // error on this line. $q = @mysql_query("update `UserDetails` set Mothership = 1, gold=gold-'$pris' where ID='$user->ID' "); if (!$q) { print ('Query failed: ' . mysql_error()); return; } } else return $nosold; } else return $noNaquadah; } if ($cgi[buyMS]) { if ($cgi[Mothership]) { $wal = $cgi[Mothership]; $typ = 0; $detail .= Mothership($user, $wal, $typ); } } { //echo "--$typ--"; header("Location: armory.php?strErr=$detail"); } } Quote Link to comment https://forums.phpfreaks.com/topic/84500-cant-figure-out-the-error/ Share on other sites More sharing options...
drummer101 Posted January 4, 2008 Share Posted January 4, 2008 Whats the error message? Quote Link to comment https://forums.phpfreaks.com/topic/84500-cant-figure-out-the-error/#findComment-430518 Share on other sites More sharing options...
GingerRobot Posted January 4, 2008 Share Posted January 4, 2008 There is no key used in the array on this line: if ($el[] >= $wal) { // error on this line. Since the only field you pull from the database is Mothership, i assume that was meant to be: if ($el['Mothership'] >= $wal) { // error on this line. Quote Link to comment https://forums.phpfreaks.com/topic/84500-cant-figure-out-the-error/#findComment-430520 Share on other sites More sharing options...
Dethman Posted January 4, 2008 Author Share Posted January 4, 2008 It would be $user->gold I figured it out.... Quote Link to comment https://forums.phpfreaks.com/topic/84500-cant-figure-out-the-error/#findComment-430537 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.