Jump to content

saving to Mysql database


grlayouts

Recommended Posts

ok i have a game where when people go to make a gang it should update in to places, but when i try to get the gang name to update in the players tab it doesnt work..This is what i have?

[code]
if ($step == make) {
if ($stat[taxdebt] > 0) {
print "<br><font color=red>You cannot make a Gang without <b>paying</b> your taxes. Sorry!</font><br>Right now you owe <b>$stat[taxdebt]</b>!";
include("footer.php");
exit;
}
if ($stat[credits] < 10000) {
print "You don't have enough credits to make a gang.";
quit();
}
if ($stat[triad]) {
print "You're already in a gang. Try quitting the one your in first.";
quit();
}
print "<form method=post action=zones.php?step=make&action=go>";
print "I want my gang to be called <input type=text name=tname>. <input type=submit value=Make>";
print "</form>";
if ($action == go) {
$numt = mysql_num_rows(mysql_query("select * from triads where name='$tname'"));
if ($numt > 0) {
print "There is already a gang by that name.";
quit();
}
print "You have made the gang called <a href=zones.php?step=my>[$tname]</a>.";
mysql_query("insert into triads (name,owner) values('$tname',$stat[id])");
$myt = mysql_fetch_array(mysql_query("select * from triads where name='$tname'"));
$geting = mysql_query("SELECT * FROM players WHERE where id='$stat[id]");
$getto = mysql_result($getting);
mysql_query("update players set triad=$myt[id] where id=$stat[id]");
mysql_query("update players set zone1=$myt[name] where id=$getting[id]");
mysql_query("update players set credits=credits-10000 where id=$stat[id]");
[/code]
Link to comment
Share on other sites

Just off the top of my head I want to ask what exactly you mean by "it doesn't work".  Do you mean the table isn't being updated?

Couple debugging tips:
1.) Print your queiries out so you can see what is being sent to your DB
2.) Make sure all the mysql_query calls that do updates return TRUE. If not, make use of the mysql_error function.
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.