iSpeedDevil! Posted September 20, 2008 Share Posted September 20, 2008 I have this mafia game i own, and on my admin-page, i want to be able to give people money, and i was wondering how to do it, the table is called "users" and in it is the "geld", so i'd like to insert example 10,000 into a users "geld" amount, anyone getting this? xD Thanks anyway! Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/ Share on other sites More sharing options...
.josh Posted September 21, 2008 Share Posted September 21, 2008 update users set geld = geld + 10000 where userid = x (change userid to whatever is appropriate) or manually do it in phpmyadmin. Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646750 Share on other sites More sharing options...
iSpeedDevil! Posted September 21, 2008 Author Share Posted September 21, 2008 Hmm, i came up with this script, that has an error that i dont understand <?php include "_connect.php"; include "header2.php"; include "_menu.php"; ?> <html> <head> <title>MBW Adminpanel test!</title> </head> <body bgcolor="#000000" text="#FFFFFF" vlink="#FF0000" alink="#FF0000" link="#FF0000"> <table cellpadding=0 cellspacing=0 class=td width=690> <tr> <td width='95%' valign=center> <?php if (isset($_SESSION['$cookieusername'])) { $player = $_SESSION['$cookieusername']; $online = date("U"); $online = "UPDATE accdata SET online='$online' WHERE username='$player[$cookieusername]'"; $online = mysql_query($online) or die(mysql_error()); ?> <center><img src="images/hadminpanel.png"><br> <img src="images/addweapon.png"><br> <hr color="#FF0000"><br><br> Set users money!<br><br> <table cellpadding=0 cellspacing=0 border=0> <?php if ($moderator > 1) { if (isset($_POST[submit])) { $name = $_POST[name]; $money = $_POST[geld]; $date = date("r"); If (strlen($name) != "0" and strlen($money) != "0") { mysql_query("INSERT INTO users(username,geld,online)VALUES('$name', '$money', '$date')") or die(mysql_error()); print "Money updated!."; } else { print "Fill in all the fields!"; } } } ?> <tr><form method=POST action="test3.php"> <td width="150">Username:</td></tr> <tr><td><input type="text" name="name" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Money:</td></tr> <tr><td><input type="text" name="geld" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Type (w or a)</td></tr> <tr><td> <select size="1" name="type" size="20" style="color: #FF0000; background-color: #000000"> </td></tr> <tr><td><input type="submit" value="Edit" name="submit"></td></tr> </form> <?php } else { print "You dont have admin rights to view this page!."; } else { print "You are not logged in."; } ?> </body> </html> Here we have the error Parse error: syntax error, unexpected T_ELSE in /customers/mafiabossworld.com/mafiabossworld.com/httpd.www/test3.php on line 69 And before this, i just said "You are not logged in." dont understand it, the "header2.php" that is included looks like this: <?PHP require "_connect.php"; require_once "functions.php"; //Including files //Begin Variables $actual_time = time(); //End Variables $lijstGebruikers = "SELECT * FROM users WHERE username='$cookieusername'"; $resultLijstGebruikers = mysql_query($lijstGebruikers); if (mysql_num_rows($resultLijstGebruikers) == 1) { $check = "pos"; } else { $melding = "You are not logged in. You will be redirected to the login page in 2 seconds" . "<META http-equiv=refresh content=\"1;url=index.php\">"; } UpdateTable(users,online,$actual_time,username,$cookieusername); //Set Online Status $lijstGebruikers = "SELECT * FROM users WHERE username='$cookieusername'"; $resultLijstGebruikers = mysql_query($lijstGebruikers); while ($row = mysql_fetch_array($resultLijstGebruikers)) { $username = $row[username]; $password = $row[password]; $rank = $row[rang]; $geld = $row[geld]; $crew = $row[crew]; $health = $row[health]; $gun = $row[gun]; $protection = $row[protection]; $quote = $row[quote]; $kills = $row[kills]; $crime = $row[crime]; $gta = $row[gta]; $oc = $row[oc]; $locatie = $row[locatie]; $recover = $row[recover]; $travel = $row[travel]; $bank = $row[bank]; $timebank = $row[timebank]; $online = $row[online]; $moderator = $row[moderator]; $signedup = $row[signedup]; $blank = $row[blank]; $latina = $row[latina]; $asian = $row[asian]; $black = $row[black]; $specialised = $row[specialised]; $level = $row[level]; } $lijstGebruikers = "SELECT * FROM jail WHERE whoinjail='$cookieusername'"; $resultLijstGebruikers = mysql_query($lijstGebruikers); while ($row = mysql_fetch_array($resultLijstGebruikers)) { $time_left = $row[tillwhen]; } if((time() < $time_left) ) { } else { $sql = "DELETE FROM jail WHERE whoinjail='$cookieusername'"; $result = mysql_query($sql); if ($result) { } else { $melding = "An Error in the database occured, please contact the Admin about this."; } } //Getting user's information $protection_2 = SetProtection($protection,$cookieusername); $gun_2 = SetGun($gun,$cookieusername); $rank_value = SetRank($rank,$cookieusername); $health_color = SetHealthColor($health,$cookieusername); if ($crew == 0) { $crew2 = "Not part of a crew"; } //Including _setall.php for giving the gun and protection string names $lijstGebruikers2 = "SELECT * FROM crews WHERE boss='$cookieusername'"; $resultLijstGebruikers2 = mysql_query($lijstGebruikers2); while ($row2 = mysql_fetch_array($resultLijstGebruikers2)) { $boss = $row2[id]; } //Reading crew table to see if You are boss $lijstGebruikers = "SELECT * FROM crews WHERE id='$crew'"; $resultLijstGebruikers = mysql_query($lijstGebruikers); while ($row = mysql_fetch_array($resultLijstGebruikers)) { $crew_name = $row[name]; $crew_boss = $row[boss]; $crew_bank = $row[bank]; $crew_recruiter = $row[recruiter]; $crew_cleaner = $row[cleaner]; } include "_ip_block.php"; if ($ip_check == "neg") { $melding = "You are blocked for the reason: $reason"; } if(! ($nomessage == 1)) { if($health == 0) { print <<<ENDHTML <title>Gangster :: v2.10 Beta :: You Died!</title> <link rel="stylesheet" type="text/css" href="src/standard.css" /> <center> <div class="window"> <div class="mainTitle">You has been send to Hell!</div> <div class="mainText"> Your account has been killed! <a href="register.php">Click here to Create an new player!</a> </div> </div> </div> </center> ENDHTML; exit; } } ?> What might be the problem, anyone? Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646798 Share on other sites More sharing options...
redarrow Posted September 21, 2008 Share Posted September 21, 2008 you dont need this add this >>You are not logged in << to the last statement else { print "You are not logged in."; } Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646800 Share on other sites More sharing options...
redarrow Posted September 21, 2008 Share Posted September 21, 2008 <?php session_start(); << added.... include "_connect.php"; include "header2.php"; include "_menu.php"; ?> <html> <head> <title>MBW Adminpanel test!</title> </head> <body bgcolor="#000000" text="#FFFFFF" vlink="#FF0000" alink="#FF0000" link="#FF0000"> <table cellpadding=0 cellspacing=0 class=td width=690> <tr> <td width='95%' valign=center> <?php if (isset($_SESSION['$cookieusername'])) { $player = $_SESSION['$cookieusername']; $online = date("U"); $online = "UPDATE accdata SET online='$online' WHERE username='$player[$cookieusername]'"; $online = mysql_query($online) or die(mysql_error()); ?> <center><img src="images/hadminpanel.png"><br> <img src="images/addweapon.png"><br> <hr color="#FF0000"><br><br> Set users money!<br><br> <table cellpadding=0 cellspacing=0 border=0> <?php if ($moderator > 1) { if (isset($_POST[submit])) { $name = $_POST[name]; $money = $_POST[geld]; $date = date("r"); If (strlen($name) != "0" and strlen($money) != "0") { mysql_query("INSERT INTO users(username,geld,online)VALUES('$name', '$money', '$date')") or die(mysql_error()); print "Money updated!."; } else { print "Fill in all the fields!"; } } } ?> <tr><form method=POST action="test3.php"> <td width="150">Username:</td></tr> <tr><td><input type="text" name="name" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Money:</td></tr> <tr><td><input type="text" name="geld" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Type (w or a)</td></tr> <tr><td> <select size="1" name="type" size="20" style="color: #FF0000; background-color: #000000"> </td></tr> <tr><td><input type="submit" value="Edit" name="submit"></td></tr> </form> <?php } else { print "You dont have admin rights to view this page!."; } //added...... if(!$_SESSION['$cookieusername']){ print "You are not logged in."; } ?> </body> </html> [code] [/code] Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646803 Share on other sites More sharing options...
iSpeedDevil! Posted September 21, 2008 Author Share Posted September 21, 2008 Now the page is just abosuley grey, no errors, not even what its supposed to show! script now: <?php session_start(); include "_connect.php"; include "header2.php"; include "_menu.php"; ?> <html> <head> <title>MBW Adminpanel test!</title> </head> <body bgcolor="#000000" text="#FFFFFF" vlink="#FF0000" alink="#FF0000" link="#FF0000"> <table cellpadding=0 cellspacing=0 class=td width=690> <tr> <td width='95%' valign=center> <?php if (isset($_SESSION['$cookieusername'])) { $player = $_SESSION['$cookieusername']; $online = date("U"); $online = "UPDATE accdata SET online='$online' WHERE username='$player[$cookieusername]'"; $online = mysql_query($online) or die(mysql_error()); ?> <center><img src="images/hadminpanel.png"><br> <img src="images/addweapon.png"><br> <hr color="#FF0000"><br><br> Set users money!<br><br> <table cellpadding=0 cellspacing=0 border=0> <?php if ($moderator > 1) { } if (isset($_POST[submit])) { $name = $_POST[name]; $money = $_POST[geld]; $date = date("r"); If (strlen($name) != "0" and strlen($money) != "0") { mysql_query("INSERT INTO users(username,geld,online)VALUES('$name', '$money', '$date')") or die(mysql_error()); print "Money updated!."; } else { print "Fill in all the fields!"; } } ?> <tr><form method=POST action="test3.php"> <td width="150">Username:</td></tr> <tr><td><input type="text" name="name" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Money:</td></tr> <tr><td><input type="text" name="geld" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Type (w or a)</td></tr> <tr><td> <select size="1" name="type" size="20" style="color: #FF0000; background-color: #000000"> </td></tr> <tr><td><input type="submit" value="Edit" name="submit"></td></tr> </form> <?php if ($moderator < 1) { } print "You dont have admin rights to view this page!."; } if($_SESSION['$cookieusername']){ print "You are not logged in."; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646810 Share on other sites More sharing options...
redarrow Posted September 21, 2008 Share Posted September 21, 2008 try this then <?php include "_connect.php"; include "header2.php"; include "_menu.php"; ?> <html> <head> <title>MBW Adminpanel test!</title> </head> <body bgcolor="#000000" text="#FFFFFF" vlink="#FF0000" alink="#FF0000" link="#FF0000"> <table cellpadding=0 cellspacing=0 class=td width=690> <tr> <td width='95%' valign=center> <?php if (isset($_SESSION['$cookieusername'])) { $player = $_SESSION['$cookieusername']; $online = date("U"); $online = "UPDATE accdata SET online='$online' WHERE username='$player[$cookieusername]'"; $online = mysql_query($online) or die(mysql_error()); ?> <center><img src="images/hadminpanel.png"><br> <img src="images/addweapon.png"><br> <hr color="#FF0000"><br><br> Set users money!<br><br> <table cellpadding=0 cellspacing=0 border=0> <?php if ($moderator > 1) { } if (isset($_POST[submit])) { $name = $_POST[name]; $money = $_POST[geld]; $date = date("r"); If (strlen($name) != "0" and strlen($money) != "0") { mysql_query("INSERT INTO users(username,geld,online)VALUES('$name', '$money', '$date')") or die(mysql_error()); print "Money updated!."; } else { print "Fill in all the fields!"; } } ?> <tr><form method=POST action="test3.php"> <td width="150">Username:</td></tr> <tr><td><input type="text" name="name" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Money:</td></tr> <tr><td><input type="text" name="geld" size="20" style="color: #FF0000; background-color: #000000" align=left></td></tr> <td width="150">Type (w or a)</td></tr> <tr><td> <select size="1" name="type" size="20" style="color: #FF0000; background-color: #000000"> </td></tr> <tr><td><input type="submit" value="Edit" name="submit"></td></tr> </form> <?php if ($moderator < 1) { } print "You dont have admin rights to view this page!."; } if($_SESSION['$cookieusername']){ print "You are not logged in."; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646812 Share on other sites More sharing options...
iSpeedDevil! Posted September 21, 2008 Author Share Posted September 21, 2008 Still nothing Quote Link to comment https://forums.phpfreaks.com/topic/125133-how-do-i-give-an-value-to-mysql/#findComment-646944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.