I'm actually getting sick of asking for help. I've spent an hour+ fixing this damn script around, and finally the only thing wrong with it is the following code.
Code: Select all
$name = $_POST['monname'];
$sql = mysql_query("SELECT temp FROM user WHERE username = '$user'");
$type = mysql_fetch_array($sql);
//$monnum = mysql_query("");
// $monnum = mysql_fetch_array($monnum);
$query = mysql_query("SELECT monnum FROM user WHERE username = '$user'");
$row = mysql_fetch_array($query);
$monnum = $row['monnum'];
mysql_query("INSERT INTO monster (ID, name, type, traintype, lifeexp, wins, losses, srp, stam, str, con, agi, luk, age, item1, item2, trainer)
VALUES ('', '$name', '{$type['temp']}', '', '90', '0', '0', '0', '1', '3', '3', '3', '3', '0', '', '', '$user')")or die(mysql_error());
$query = mysql_query("SELECT ID FROM monster WHERE trainer = '$user' AND name = '$name'");
$row = mysql_fetch_array($query);
$idtoadd = $row['ID'];
if ($monnum == '0')
{
mysql_query("UPDATE user SET monid1 = '$idtoadd' WHERE username = '$user'");
}
if ($monnum == '1')
{
mysql_query("UPDATE user SET monid2 = '$idtoadd' WHERE username = '$user'");
}
if ($monnum == '2')
{
mysql_query("UPDATE user SET monid3 = '$idtoadd' WHERE username = '$user'");
}
if ($monnum == '3')
{
mysql_query("UPDATE user SET monid4 = '$idtoadd' WHERE username = '$user'");
}
if ($monnum == '4')
{
mysql_query("UPDATE user SET monid5 = '$idtoadd' WHERE username = '$user'");
}
It eventually adds monnum to 127 and I guess it gives up after that. Don't ask me why, but, it just does. So anyway. I've taken away a piece of the code that I thought was doing it, and STILL nothing. I see NOTHING that would add anything to monnum.
Edit: Is there a way to donate to Devnetwork? I feel I atleast owe something to you guys. I'd still be making cookies if not for ya'll.