Jump to content

Cant Figure out the eRRor!


Dethman

Recommended Posts

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");

	}
}

Link to comment
https://forums.phpfreaks.com/topic/84500-cant-figure-out-the-error/
Share on other sites

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.

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.