Jump to content

[SOLVED] mysql insert


uwannadonkey

Recommended Posts

table market1 contains the columns "owner" "price" and "amount", and "id"

 

<?php
include('inc/header.php');

$_GET[amount]=$amount1;
$_GET[price] = $price;

if ($user->crystal < $amount1)
{
echo'You dont have that many crystals!';
}
elseif ($amount1 <= 0)
{
echo' Please Enter a correct amount of crystals';
}
else
{
//Insert 
//setup our query
$query = "INSERT INTO market1(owner, amount, price) VALUES ('$user->ID', '$amount1', '$price' )";

//run query
mysql_query($query) or die("MySQL Error: " . mysql_error());
}


echo'
<center>
<form method=GET name=addcrystal>

  Number of Crystals To add:
  <input name=amount size=12 maxlength=3><br>
  Price of each Crystal:
  <input name=price size=12 maxlength=8>
  <input type=submit name=submit id=submit value=Submit>
</center>
';







include('inc/footer.php');
?>

 

nothing is getting inserted, yet no errors are showing?

Link to comment
Share on other sites

since u insist, and i know the problems arent there:

 

header.php

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2438572-1";
urchinTracker();
</script>
<?php

if(isset($_COOKIE[username]))
{
include ('inc/connect.php');
include ('inc/define.php');
$result = @mysql_query("SELECT * FROM users WHERE username = '$_COOKIE[username]'"); 
$temp = @mysql_fetch_object($result);
$user = $temp; 
}
else
{
header('location:index.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="inc/style.css" rel="stylesheet" type="text/css" />
<title> Welcome to Magical Wars, <?php echo"$user->display_name";?></title>
</head>
<body>
<br><BR><BR><BR><BR><BR>
	<div id="container">
<div id="header">
<ul>
		<FONT color=#FFFFFF><center>Level : <?php echo ''.$user->level.''; ?> |  Magic Energy :  <?php echo ''.$user->energy.''; ?> / <?php echo ''.$user->max_energy.''; ?> | Exp : <?php echo ''.$user->exp.''; ?> / <?php echo ''.$user->exp_required.''; ?> | Health :  <?php echo ''.$user->hp.''; ?> / <?php echo ''.$user->max_hp.''; ?> |  <br>Gold: <?php echo ''.$user->gold.''; ?> | Diamonds: <?php echo ''.$user->diamond.''; ?> |</center>
</ul>
</div>

<div id="content">
	<div id="left">
		<div class="menu">
			<div class="menuheader"><h3>Personal Area</h3></div>
			<div class="menucontent">
				<ul>
					<li><a href="profile.php">Home</a></li>
					<li><a href="news.php">News</a></li>
					<li><a href="bank.php">Banking</a></li>
					<li><a href="ranking.php">Ranking</a></li>
					<li><a href="chat.php">Shout-Box(notyet)</a></li>
					<li><a href="battle.php">Battle Zone</a></li>
					<li><a href="stats.php">Statistics Page(notyeT)</a></li>
					<li><a href="account.php">Your Account(notyet)</a></li>
				</ul>
			</div>
			<div class="menufooter"></div>
		</div>
		<div class="menu">
		<div class="menuheader"><h3>City</h3></div>
		<div class="menucontent">

<ul>

				<li><a href="clan2.php">Clan</a></li>
<li><a href="mining.php">Mining</a></li>
	<li><a href="forest.php">Forest</a></li>
					<li><a href="train1.php">Training</a></li>
<li><a href="heal.php">Fountain</a></li>

					<li><a href="convert.php">Convert(notyet)</a></li>
			<li><a href="clan.php">Element</a></li>

					<li><a href="fishing.php">Fishing(not yet)</a></li>
<li><a href="magic.php">Ye Olde Magic Shop</a></li>
				</ul>









</div>
<div class="menufooter"></div>

			<div class="menuheader"><h3>Game Stats</h3></div>
			<div class="menucontent">
				<ul>
<?php
echo'Battles Fought:';
$sql = mysql_query("SELECT MAX(ID) as maxID FROM battles")or die(mysql_error());
$row = mysql_fetch_array($sql);
echo $row['maxID'];
echo'<br>';
echo'Players Registered:';
$sql = mysql_query("SELECT MAX(ID) as maxID FROM users")or die(mysql_error());
$row = mysql_fetch_array($sql);
echo $row['maxID'];

;?>
				</ul>
			</div>

			</div>
			<div class="menufooter"></div>
		</div>
	</div>


	<div id="right">
		<div class="menu">
			<div class="menuheader"><h3>Recent Actions</h3></div>
			<div class="menucontent">
				<ul>
					<li><a href=mail.php>Mail(not yet)</a></li>
                                                <li><a href=battlelogs.php>Battle logs(soon!)</a></li>
<li><a href=bank.php>Bank Gold</a></li> 

				</ul><div class="menufooter"></div>

<div class="menuheader"><h3>Energy Zone</h3></div>


<ul>

Magic Crystals: <?php echo "$user->crystal";?>
<li><a href=makecrystal.php>Make Crystals</a></li>
<li><a href=usecrystal.php>Use Crystals</a></li>
</ul>
</ul><div class="menufooter"></div>


<div class="menuheader"><h3>Chat</h3></div>




<!-- BEGIN CBOX - http://www.cbox.ws -->
<div align="center" id="cboxdiv">
<iframe frameborder="0" width="160" height="305" src="http://www3.cbox.ws/box/?boxid=2688957&boxtag=8561&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#000000 1px solid;" id="cboxmain"></iframe><br/>
<iframe frameborder="0" width="160" height="75" src="http://www3.cbox.ws/box/?boxid=2688957&boxtag=8561&sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#000000 1px solid;border-top:0px" id="cboxform"></iframe>
</div>
<!-- END CBOX -->






<div class="menufooter"></div>
				<div class="clear"></div>
			</div>


		</div>
	</div>
	<div id="middle">
		<div class="post">
			<div class="postheader"><h1>Post title</h1></div>
			<div class="postcontent">

 

footer.php

			</div>
			<div class="postfooter"></div>

<BR><center><img src="http://www.easycounter.com/counter.php?uwannadonkey"
border="0" alt="Web Site Hit Counters"></a>
<br>
</center>
		</div>
	</div>
</div>
<div id="footer">
	<ul>
	</ul>
</div>	
</div>
</body>
</html>

<center>
<script type="text/javascript"><!--
google_ad_client = "pub-6485715447355686";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
<script type="text/javascript"><!--
google_ad_client = "pub-6485715447355686";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

 

oh, since u will prolly say"lemme see ur includes in the header"

 

ill give u those

 

 

define.php

 

<?php
if($_SERVER['PHP_SELF'] == '/inc/define.php') { header('Location: /index.php'); exit; }

$free = '20';
define('GAME_SHUTDOWN',     FALSE);
define('GAME_SHUTDOWN_MSG', 'GTFO');
define('GAME_SHUTDOWN_URL', '/temp/sorry.html');

//settings
define('DEBUG_MODE',         FALSE);
define('MIN_NAME_LENGTH',        2);
define('MAX_NAME_LENGTH',       32);
define('MIN_USERNAME_LENGTH',    2);
define('MAX_USERNAME_LENGTH',   32);
define('MIN_PASSWORD_LENGTH',    4);
define('MAX_AVATAR_SIZE_KB',  1024);
define('MAX_AVATAR_WIDTH',     100);
define('MAX_AVATAR_HEIGHT',    100);
define('MIN_SIG_LENGTH',        1);
define('MAX_SIG_LENGTH',       10000);

define('AVATAR_DIR', 'player_images');
define('TEMP_DIR',   'temp');

define('ENERGY_INCREMENT',     5);

define('NOT_ACTIVATED', -128); 
define('CRIMINAL',  -127); 
define('PLAYER',           0);
define('STAFF',          120);
define('IMP',          124);
define('CODER',           125);
define('ADMIN',          126);
define('OWNER',          127);
define('GAME_EMAIL_ADDRESS', 'DoNotReply@donkey.com');


function preventTags(&$str) {
    return str_replace(array('<','>'), array('<','>'), $str);
}
function getPermissionLevelName(&$user) {
    switch($user->permission_level) {
        case PLAYER        : if($user->donator_days > 0) { return 'Donator'; } return 'Player';
        case CRIMINAL      : return 'Criminal';
        case CODER         : return 'Coder';
        case ADMIN         : return 'Admin';
        case IMP           : return 'IMP';
        case OWNER         : return 'Owner';
        case STAFF         : return 'Staff';
        case NOT_ACTIVATED : return 'Illegal Immigrant';
        default            : return 'Player';
    }
}

function colorName(&$user) {
    $color     = '';
    $startTags = '';
    $endTags   = '';
    switch($user->permission_level) {
        case PLAYER        : if($user->donator_days != 0) { $color = '#00FF00'; } else { $color = '#FFFFFF'; } break;
        case NOT_ACTIVATED : $color = '#FFFFFF'; break;
        case ADMIN         : $startTags = '<STRONG>'; $color = 'yellow'; $endTags = '</STRONG>'; break;
case CODER         : $startTags = '<STRONG>'; $color = '#2346ff'; $endTags = '</STRONG>'; break;
        case OWNER         : $startTags = '<STRONG>'; $color = 'Red'; $endTags = '</STRONG>'; break;
         case IMP        : $startTags = '<STRONG>'; $color = 'Pink'; $endTags = '</STRONG>'; break;
  case STAFF        : $startTags = '<STRONG>'; $color = '#2282ed'; $endTags = '</STRONG>'; break;
        default            : $color = '#FFFFFF'; break;
    }
    return $startTags . '<SPAN style="COLOR: ' . $color . ';">' . $user->display_name . '</SPAN>' . $endTags;
}


?>

 

 

OH, and my connect.php

 


<?php
ob_start();
$conn = mysql_connect ("localhost", "donkey9_Admin", "*****") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("donkey9_Game");
?>


 

i am not some stupid coder, this is prolly some really dumb error i made, ON THE CODE i first posted, and i know that.  if u want, waste all night looking at the other files to find NO other problem, because my other 80 pages work perfectly fine with those files

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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