UPDATE Problem
Posted by:
Adam 552
Date: October 01, 2007 02:10PM
<?php
// Connects to your Database
mysql_connect("---", "---", "---") or die(mysql_error());
mysql_select_db("---") or die(mysql_error());
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
$result = mysql_query("SELECT army FROM users WHERE username = '$username'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$bob = mysql_fetch_row($result);
// now we insert it into the database
$insert = "UPDATE users SET army=('".$_POST['army']."') WHERE army = '$bob[0]'";
$add_member = mysql_query($insert);
?>
<!-- Now we let them know if their registration was successful -->
<h1>Changed Army Name!</h1>
<p>Now go back to your <a href="overview.php">town</a>.</p>
<?php
}
else
{
?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<?php
$toast = mysql_query("SELECT army FROM users WHERE username = '$username'");
if (!$toast) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$chip = mysql_fetch_row($toast);
$result = mysql_query("SELECT owner FROM users WHERE username = '$username'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
if ($row[0] == 'true'){
echo '<table class="vis" width="100%">
<tr><th colspan="2">Properties</th></tr>
<tr><td>Change Name??:</td><td><input type="text" name="army" value="';
echo $chip[0];
echo '" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Change" /></td></tr>';
}
?>
</form>
<?php
}
?>
I don't know what but this script doesn't work...
Subject
Written By
Posted
UPDATE Problem
October 01, 2007 02:10PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.